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

Would this work?

Asked by
IcyEvil 260 Moderation Voter
9 years ago

The only thing I know on the :MoveTo() Method Is that it Can As in the name MoveTo Moves something To something, And It is needed for My game, here is the script.

function Killed()
if v.Character.Humanoid.Health == 0 then
v.Character.Humanoid.Health = 100
elseif v.Character.Humanoid.Health == 100 then
v:MoveTo("SpawnLocation")
end
end
end
0
If you know nothing about it, you can't say your game needs it. What exactly are you trying to do? adark 5487 — 9y
0
Im trying to get it to Teleport the Player to The SpawnLocation, Here I realized I need to fix something. IcyEvil 260 — 9y

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

1. v is nil. 2. If their health is 0, setting it to 100 will not do anything because they are already dead. 3. MoveTo() takes a Vector3 value, not a string value. 4. You have too many ends.

I'll assume you want to move then to a brick named spawn location each time someone dies. For this we can use a character added event.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(chr)
        chr:MoveTo(workspace.SpawnLocation.Position)
    end)
end)
Ad

Answer this question