the script is a local script inside the gui
local player = game:GetService("Players").LocalPlayer game.Workspace.teleport.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then player.RespawnLocation = Vector3.new(game.Workspace.teleport.Position) end end)
but im only getting the error "Players.Gameplayer365247v2.PlayerGui.ScreenGui.speed.LocalScript:4: bad argument #3 to 'RespawnLocation' (Object expected, got Vector3)" idk what that means
Firstly, the Property RespawnLocation
is suppose to be a SpawnLocation part(not a regular part), not a Position. Second, if you have workspace.FilteringEnabled
on, then this script should not be in the client side.
Make a new regular script in workspace which would have this code in it:
local Players = game:GetService("Players") workspace.teleport.Touched:connect(function(Part) local Player = Players:GetPlayerFromCharacter(Part.Parent) --if a part of your player touches it, then Part.Parent would be the character model that part is in, and :GetPlayerFromCharacter gets the player in Players from that character model if Player then Player.RespawnLocation = workspace.teleport end end)