system = script.Parent
model = system.Box --
backup = model:Clone()
regen = system.Regen
game.Players.PlayerAdded:Connect(function(plr)
local gamepassId = 148181594
local market = game:GetService("MarketplaceService")
function checkRegen()
if regen.Value == 1 then
if market:UserOwnsGamePassAsync(plr.UserId,gamepassId) then
wait(1)
model = backup:Clone()
model.Parent = system
model:MakeJoints()
else
market:PromptGamePassPurchase(plr, gamepassId)
end
end
end
end)
regen.Changed:Connect(checkRegen)
this was the error, btw when I dont do the game pass thing it does work.
Attempt to connect failed: Passed value is not a function
that is the intire script btw this one does work so its something with the gamepass
system = script.Parent
model = system.Box --
backup = model:Clone()
regen = system.Regen
function checkRegen()
if regen.Value == 1 then
wait(1)
model = backup:Clone()
model.Parent = system
model:MakeJoints()
end
end
regen.Changed:Connect(checkRegen)
system = script.Parent
model = system.Box --
backup = model:Clone()
regen = system.Regen
game.Players.PlayerAdded:Connect(function(plr)
local gamepassId = 148181594
local market = game:GetService("MarketplaceService")
end)
function checkRegen()
if regen.Value == 1 then
if market:UserOwnsGamePassAsync(plr.UserId,gamepassId) then
wait(1)
model = backup:Clone()
model.Parent = system
model:MakeJoints()
else
market:PromptGamePassPurchase(plr, gamepassId)
end
end
end
regen.Changed:Connect(checkRegen)