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

rigged r6 model not follwing me through script?

I made a robot pet looking thing, rigged him, animated, all that. He just doesn't follow me.

Here is the script:

local enmhum = script.Parent.Humanoid
local anm = script.Parent.Humanoid.Animation
local load = script.Parent.Humanoid:LoadAnimation(anm)

while wait() do
	for i, v in pairs(game:GetChildren())do
		local character = game.Workspace:WaitForChild(v.Name)
		enmhum:MoveTo(character.PrimaryPart.Position)
		load:Play()
		enmhum.MoveToFinished:Wait(1)
		load:Stop()
	end
end

It's a normal script located inside the model. Thanks to anyone who helps :)

3 answers

✓ Accepted answer

local enmhum = script.Parent.Humanoid
local anm = script.Parent.Humanoid.Animation
local load = script.Parent.Humanoid:LoadAnimation(anm)

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)  
while wait() do
        enmhum:MoveTo(character.PrimaryPart.Position)
        load:Play()
        enmhum.MoveToFinished:Wait()
        load:Stop()
end
end)
end)

Try this

local enmhum = script.Parent.Humanoid
local anm = script.Parent.Humanoid.Animation
local load = script.Parent.Humanoid:LoadAnimation(anm)

while wait() do
    local character = game.Workspace:FindFirstChild("TabooAntonioiscool")

    if character then
        enmhum:MoveTo(character.PrimaryPart.Position)
        load:Play()
        enmhum.MoveToFinished:Wait()
        load:Stop()
    end
end

1 comment

0

Also how would you make it so it goes to the local player instead of just me?

Would this work?

local enmhum = script.Parent.Humanoid
local anm = script.Parent.Humanoid.Animation
local load = script.Parent.Humanoid:LoadAnimation(anm)

game.Players.PlayerAdded:Connect(function(player)
	while wait() do
    local character = player
    if character then
        enmhum:MoveTo(character.PrimaryPart.Position)
        load:Play()
        enmhum.MoveToFinished:Wait()
        load:Stop()
    end
end
end)


1 comment

0

player.Character.Name

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