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

rigged r6 model not follwing me through script?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
Ad
Log in to vote
0
Answered by 4 years ago

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

0
Also how would you make it so it goes to the local player instead of just me? TabooAntonioiscool 42 — 4y
Log in to vote
0
Answered by 4 years ago

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)


0
player.Character.Name Nguyenlegiahung 1091 — 4y

Answer this question