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 4 years ago
Edited 4 years ago

Script:

local id = 6867225
local mps = game:GetService("MarketplaceService")

script.Parent.ClickDetector.MouseClick:Connect(function(p)
    if mps:UserOwnsGamePassAsync(p.UserId, id) then
    local char = p:WaitForChild("Character") or p.CharacterAdded
    char.HumanoidRootPart.CFrame = CFrame.new(0, 50, 0)
    end
end)

1 answer

Log in to vote
3
Answered by 4 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 — 4y
0
yeah, `p.Character or p.CharacterAdded:Wait()` Psudar 882 — 4y
Ad

Answer this question