Ad
Log in to vote
0

the ":MoveTo" function does not wanna work, what do I do?

Asked by 11 days ago

so I want to make their horse spawn next to the player, however it does not even move, and it just spawns at the orgin, what do I do?

script:

local remote = script.Parent
local horseFolder = game:GetService("ReplicatedStorage").OtherThings.Items.HorseFolder

remote.OnServerEvent:Connect(function(player, horseLocation)
    print(horseLocation)
    local random = math.random(1,10)
    local abilityFolder = player:WaitForChild("AbilityUnlocked")
    local horseNumber = abilityFolder:WaitForChild("Horse")
    if horseNumber.Value == 0 then
        horseNumber.Value = random
        if horseNumber.Value == 10 then
            local robot = horseFolder.RoboticHorse:Clone()
            robot.Name = player.Name.."'s Robot Horse"
            robot:MoveTo(horseLocation) --<----- Problem is here
            robot.Parent = game.Workspace
        else
            local horse = horseFolder.Horse:Clone()
            horse.Name = player.Name.."'s Horse"
            horse:MoveTo(horseLocation)  --<----- Problem is here too
            horse.Parent = game.Workspace
        end
    end
end)

incase someone needs to see the local script that sends the Vector3 value of position:

local UIS = game:GetService("UserInputService")
local keyBind = Enum.KeyCode.H
local player = game.Players.LocalPlayer

UIS.InputBegan:Connect(function(key)
    if key.KeyCode == keyBind then
        local location = player.Character.HumanoidRootPart.Position
        local horseLocation = location - Vector3.new(4,0,0)
        script.HorseSummon:FireServer(horseLocation)
    end
end)

1 answer

Log in to vote
0
Answered by 10 days ago

You can only use MoveTo on a Humanoid. If you are trying to move the entire model, I would go with @jamespringles's answer.

Ad

Answer this question