local part1 = player.Character.Head
local part2 = script.Parent
while true do
wait()
local magnitude = (part1.HumanoidRootPart.Position - part2.Position).magnitude
if magnitude < 50 then
workspace.gj.Humanoid:MoveTo(part1)
wait()
end
end end
game.Players.PlayerAdded:Connect(joined)
This should work, but it doesnt recognize head. it says “attempt to index nil with Head”
PS this is a normal script.
local char = player.Character or player.CharacterAdded:Wait()
local part1 = char.Head
...
What this does is check if the character exists and if it doesn’t, wait until it gets added. Then index the head, because the head should exist by now.
Wait no I didnt… I don’t know whats wrong with this
function joined(player)
local char = player.Character or player.CharacterAdded:Wait()
local part1 = char.Head
local part2 = script.Parent
while true do
wait()
local magnitude = (part1.HumanoidRootPart.Position - part2.Position).magnitude
if magnitude < 50 then
script.Parnet.Parent.Parent.Parent.gj.Humanoid:MoveTo(part1)
wait()
end
end end
game.Players.CharacterAdded:Connect(joined)
You have to correct the player thing to character so it would be like this
function CharAdded(char)
local head = char.Head
end
game.Players.CharacterAdded:Connect(CharAdded)
function joined(player)
local char = player.Character or player.CharacterAdded:Wait()
local part1 = char.Head
local part2 = script.Parent
while true do
wait()
local magnitude = (part1.HumanoidRootPart.Position - part2.Position).magnitude
if magnitude < 50 then
script.Parnet.Parent.Parent.Parent.gj.Humanoid:MoveTo(part1)
wait()
end
end
game.Players.PlayerAdded:Connect(joined)
As I promised, here’s “THE SENTINEL”
They run off of fire. They were created in the medieval times to fight off spirits, but eventually the king didnt know what to do with the spirits. So he forced them into “The Sentinels”, even if he knew that the sentinels are extremely strong, the sentinels rust in the rain, so the king hoped they would all rust away.