local mps = game:GetService("MarketplaceService")
local button = script.Parent
local gamePassID = 18411129
local AnotherBrick = game.Workspace.winners
button.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if mps:PlayerOwnsAsset(player, gamePassID) then
print("Player has pass.")
player:MoveTo(AnotherBrick.Position) -- 5
end
end
end
end)
✓ ANSWER ACCEPTED
I am getting an error code when running this script. What is incorrect?
1 answer
✓ Accepted answer
Your problem is probably you trying to use :MoveTo on a player instance.
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
Player is player instance and
player:MoveTo(AnotherBrick.Position) -- 5
Won't work. To fix it, move the players character humanoid o think it is, if it's not the humanoid then it's the character.
player.Character.Humanoid:MoveTo(AnotherBrick.CFrame)
2 comments
0
thx dude
0
thE lEmON mAdE mE dO iT
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Whats the error code
Please mark my answer as correct if it works plsss