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

Im trying to make a teleport button, where only vip can teleport. Why wont this code work?

Asked by 5 years ago
Edited 5 years ago

Script:

1local id = 6867225
2local mps = game:GetService("MarketplaceService")
3 
4script.Parent.ClickDetector.MouseClick:Connect(function(p)
5    if mps:UserOwnsGamePassAsync(p.UserId, id) then
6    local char = p:WaitForChild("Character") or p.CharacterAdded
7    char.HumanoidRootPart.CFrame = CFrame.new(0, 50, 0)
8    end
9end)

1 answer

Log in to vote
3
Answered by 5 years ago

Character is not a child of player, try p.Character instead of p:WaitForChild("Character").

0
Im waiting for the owner, to check if it works! mdbaten2 24 — 5y
0
yeah, `p.Character or p.CharacterAdded:Wait()` Psudar 882 — 5y
Ad

Answer this question