I am trying to make a script for a gamepass that gives gravity coil and another for speed coil but only the speed coil one works and I dont know what the problem is there. I tried asking in another forum but couldnt find a solution. Here are the scripts and info:
the bug / issue:
the locations of things
GamepassManager script:
local MarketplaceService = game:GetService("MarketplaceService")
local passFunctions = {}
passFunctions[86737822] = function(player)
if not player.Character then
return
end
local newGravityCoil = script.Parent.Script.GravityCoil:Clone()
newGravityCoil.Parent = player.Backpack
end
passFunctions[87111630] = function(player)
if not player.Character then
return
end
local newSpeedCoil = script.Parent.SpeedCoil:Clone()
newSpeedCoil.Parent = player.Backpack
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, purchasedPassId, purchaseSuccess)
if purchaseSuccess then
passFunctions[purchasedPassId](player)
end
end)
the script above the gravity coil tool:
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassID = 86737822
local ToolName = "GravityCoil"
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassID) then
script[ToolName]:Clone().Parent = player.Backpack
end
end)
end)
the script above the speed coil tool:
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassID = 87111630
local ToolName = "SpeedCoil"
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassID) then
script[ToolName]:Clone().Parent = player.Backpack
end
end)
end)
the script for the guis if u need it:
gravity one:
last ones are for the gui the very first one is for the player to receive the gamepasses I think and the middle two are for checking if they have the gamepass
there is gravity coil and speed coil
currently only the gravity one works and at the very top it shows the location of the scripts and tools aswell as where the bug is located.
that bug popped up after I bought the thing but the gravity one buys and gives item while the speed one doesnt.
Where is the script with the trouble located, and can you verify that the Speed Coil/Gravity Coil have the correct name as in the script?
What kind of a script is it?
its a script in serverscript service called gamepass manager. Iβve verified and checked many times they are the same names only the gravity coil one works but the speed coil doesnt. Like when u click to buy speed coil it buys but doesnt give the coil and the type of script isnt local its just normal script and I also made 2 scripts under serverscriptservice one for speed and one for gravity coil and underneath those are the corresponding coils.