How to prevent person buy more than 1 time?
local part = script.Parent
local marketplaceservice = game:GetService("MarketplaceService")
local VipId = 1235582640
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local sword = ReplicatedStorage:WaitForChild("Tool")
local function givethings(player)
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:FindFirstChild("Humanoid")
hum.WalkSpeed = 32
local newsword = sword:Clone()
local BackPack = player:FindFirstChild("Backpack")
newsword.Parent = BackPack
player.CharacterAdded:Connect(function(charcter)
task.wait(2)
local humanoid = charcter:WaitForChild("Humanoid")
local newsword_spawn = sword:Clone()
local BackPack = player:WaitForChild("Backpack")
if humanoid and BackPack then
humanoid.WalkSpeed = 32
newsword_spawn.Parent = BackPack
end
end)
end
marketplaceservice.PromptGamePassPurchaseFinished:Connect(function(player , gamepassid , purched)
if gamepassid == VipId and purched then
givethings(player)
end
end)
part.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
pcall(function()
marketplaceservice:PromptGamePassPurchase(plr , VipId)
end)
end
end)
** You are now Level 18! **