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

1 comment
Thanks! It worked.