Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Spawnpoint spawns me on the roof so I made a script and it doesn't work.What did I do wrong?

Asked by
Lualaxy 78
5 years ago

So I just placed a SpawnPoint in my building but it always spawns me on the roof whatever I do. So I made a script that would move the person that joins into the building.

So I went ahead and did that, but it doesn't work. The worst part is that it doesn't even say anything in the output.

My question is what did I do wrong?

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
char.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(225.502, 28.568, -236.095))
end)
end)

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

dont listen to those people, they dont know what they r doing, just simply remove vector3.new thats it but keep the numbers so the script would be

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
char.HumanoidRootPart.CFrame = CFrame.new(225.502, 28.568, -236.095)
end)
end)
0
what cframe does is that it looks for numbers and not a cframe and a position of something is the numbers you need or as in ur script just use the numbers u want Gameplayer365247v2 1055 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago

This is a rather easy fix:

local spawnPosition = game.Workspace.SpawnLocation.Position
game.Players.PlayerAdded:Connect(function(player)
    player.Character.HumanoidRootPart.Position = spawnPosition
end)

Tell me if this works. If it does, accepting my answer is much appreciated :)

0
It doesn't work... Lualaxy 78 — 5y

Answer this question