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

MoveTo() not working? [Solved]

Asked by 8 years ago

I'm attempting to get the player to move to a part whenever he or she clicks the exit button for my shop GUI. The script works fine until after the exit button is clicked. The output gave me this error:

09:49:35.692 - Unable to cast Instance to Vector3 09:49:35.692 - Script 'Players.Player1.PlayerGui.Shop.PopUpManagement', Line 30 09:49:35.693 - Stack End

local triggerTouched = false

game.workspace.Trigger.Touched:connect(function(hit)
if not triggerTouched then

triggerTouched = true

if hit.Parent then
    frame.Visible = true
    frame:TweenPosition(UDim2.new(0.5,-250,0.5,-200), "In", "Quint", 0.35, true)
    game.Players.LocalPlayer.DevComputerMovementMode = "Scriptable"
end

exitButton.MouseButton1Down:connect(function()
    triggerTouched = false
    game.Players.LocalPlayer.DevComputerMovementMode = "UserChoice"

--Make the player walk to a part once the exit button is clicked.
local Humanoid = game.Players.LocalPlayer.Character.Humanoid

Humanoid:MoveTo(game.workspace.Part)
Humanoid.MoveToFinished:connect(function()
    print("Success?")
            end)
        end)
    end
end)

EDIT: Solved

0
Thanks! It worked. Raven_Caedes 95 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Just change line 21 to Humanoid:MoveTo(game.workspace.Part.Position) . There is another doing this which is WalkToPoint.

Ad

Answer this question