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

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

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 comment

1 answer

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

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