• Register a free account to view all forum content. Click here to create your own account.

I need help with the script - Donation GUI.

Joined
Sep 13, 2018
Messages
5
Roblox
testershardal
Hello. I'm trying to add button for donations - Donation GUI. This button is checking the player's id and then depending on whether he has a game pass or not, it teleporting the player to the point "tp 1" or offer to buy a game pass. But nothing works. Would you please advise why?
This is my script. I am newbie.
Thanks:)


local id = 5068702
local Teleport = "tp 1"
local player

if not _G.Players then
_G.Players = {[id] = {}}
elseif not _G.Players[id] then
_G.Players[id] = {}
end


Table = _G.Players[id]

function CheckPlayer(player2)
for i = 1,#Table do
if Table == player2 then
return true
end
end
return false
end






Serv = game:GetService("BadgeService")
script.Parent.TextButton.MouseButton1Click :Connect(function(hit)
player = game.Players:GetPlayerFromCharacter(hit.Parent)




if Serv:UserHasBadge(player.userId,id) or CheckPlayer(player) then
game.MarketplaceService:PromptGamePassPurchase(script.Parent.Parent.Parent, id)
else
if script.Parent.Locked == false and script
.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true


local Position = script.Parent.Parent:findFirstChild(Teleport)
hit.Parent:moveTo(Position.Position)
wait(1)
script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end



end)