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

Would this work?

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

2 comments

0

If you know nothing about it, you can't say your game needs it. What exactly are you trying to do?

0

Im trying to get it to Teleport the Player to The SpawnLocation, Here I realized I need to fix something.

1 answer

✓ Accepted answer

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)

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