RichardiOS275

FE2 Client Sided moving part + Killbrick

Oct 27th, 2021
812
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- EventScript
  2.  
  3. local Lib = workspace.Multiplayer.GetMapVals:Invoke() --Has: Map, Script, Button, btnFuncs
  4. Lib.Button:connect(function(p, bNo) if Lib.btnFuncs[bNo] then Lib.btnFuncs[bNo](bNo, p) end end)
  5.  
  6. for i, plr in ipairs(game.Players:GetPlayers()) do
  7.     local char = plr.Character
  8.     local localEvent = char and char:FindFirstChild("LocalEventScript")
  9.     if localEvent then
  10.         localEvent.Disabled = true
  11.         localEvent.Disabled = false
  12.     end
  13. end
  14.  
  15. Lib.Map.Kill.OnServerEvent:Connect(function(plr)
  16.     local char = plr.Character
  17.     local hum = char and char:FindFirstChildOfClass("Humanoid")
  18.     if hum then
  19.         hum.Health = 0
  20.     end
  21. end)
  22.  
  23. Lib.Map.Start:FireAllClients()
  24.  
  25. wait(60)
  26. Lib.Script.setWaterState(Lib.Map.Intro._Water1, "acid")
  27. wait(15)
  28. Lib.Script.setWaterState(Lib.Map.Intro._Water1, "lava")
  29. wait(3)
  30. Lib.Script.moveWater(Lib.Map.Intro._Water1, Vector3.new(0, 30, 0), 10, true)
  31.  
  32. -- LocalEventScript
  33.  
  34. local Map = workspace.Multiplayer:WaitForChild("Map")
  35. local TweenService = game:GetService("TweenService")
  36.  
  37. local function moveWater(part, pos, dur, localSpace)
  38.     TweenService:Create(
  39.         part,
  40.         TweenInfo.new(
  41.             dur,
  42.             Enum.EasingStyle.Linear,
  43.             Enum.EasingDirection.Out
  44.         ),
  45.         {
  46.             CFrame = localSpace and part.CFrame * CFrame.new(pos) or part.CFrame + pos
  47.         }
  48.     ):Play()
  49. end
  50.  
  51. Map.Start.OnClientEvent:Wait()
  52.  
  53. for i, kb in ipairs(Map:GetDescendants()) do
  54.     if kb.Name == "_Kill" and kb.Parent:IsA("BasePart") then
  55.         kb.Parent.Touched:Connect(function(h)
  56.             local plrTouched = game.Players:GetPlayerFromCharacter(h.Parent)
  57.             if plrTouched and plrTouched == game.Players.LocalPlayer then
  58.                 Map.Kill:FireServer()
  59.             end
  60.         end)
  61.     end
  62. end
  63.  
  64. wait(2)
  65. moveWater(Map.Geometry._Elevator, Vector3.new(0, 30, 0), 10, true)
RAW Paste Data