Script in Client does not work, error is “destination doesn’t exist in workspace”
local Players = game:GetService("Players")
local GoTo = game.Workspace.destination
local tp3 = script.Parent
tp3.Touched:Connect(function(hit)
local w = hit.Parent:FindFirstChild("HumanoidRootPart")
for i,v in pairs(game.Players:GetPlayers()) do
Players.PlayerAdded:Connect(function(player)
local char = player.Character
local humanoid = char:FindFirstChild("Humanoid")
--Force player to walk to the GoTo
local Controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()---GetControls
Controls:Disable()
humanoid:MoveTo(GoTo.Position)
v.Humanoid.Jump = true
wait(.5)
v.Humanoid.Jump = true
wait(5)
end)
end
end
)
Also make sure that the destination part has CanCollide or Anchored enabled, it might be falling through the map and into the void which could be why the script can’t find it.
local Players = game:GetService("Players")
local GoTo = game.Workspace.destination
local tp3 = script.Parent
tp3.Touched:Connect(function(hit)
local w = hit.Parent:FindFirstChild("HumanoidRootPart")
for _,player in pairs(game.Players:GetPlayers()) do
local char = player.Character
local humanoid = char:FindFirstChild("Humanoid")
local Controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()---GetControls
Controls:Disable()
humanoid:MoveTo(GoTo.Position)
v.Humanoid.Jump = true
wait(.5)
v.Humanoid.Jump = true
wait(5)
end
end)
Try this.
Also, are you trying to get all players to walk to the destination once the part is touched or are you trying to get the player who touched the part to walk there?