Is there an error in my current script?
I am trying to implement buying teleportation in-game purchase.
This is a normal script in:
My output error:
My script:
local button = script.Parent
local GUI = script:FindFirstAncestorWhichIsA("ScreenGui")
button.MouseButton1Click:Connect(function(click)
local plr = game.Players:GetPlayerFromCharacter(click.Parent)
if plr.leaderstats.Coins.Value >= 120 then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value - 120
GUI:Destroy()
plr.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.ToPart.Position + Vector3.new(0,4,0))
end
end)
Thanks for reading!