Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i change the respawn location?

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

1 comment

0

that is the same thing as i did just with longer text so it wont work, because the position holds those 3 positions

1 answer

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)

4 comments

0

i dont have filtering enabled and i dont want it on

0

this will work whether or not FilteringEnabled is on. Your original script won't.

0

well i tested the script both exacly as u did it and with workspace.teleport.Position and neither worked, with ur script there was an error processing data and with mine there was some vector3 problem

0

Is the teleport part a SpawnLocation or a regular Part?

This discussion is preserved as it was. New answers, comments, and votes are closed.