Hi! I got theses 2 scripts here that gives the players double jump and some other abilities and they work fine. If i leave theses in starterGUI, every player that will join the game will have theses abilities. I want theses abilities to be sold as a gamepass so not everyone has theses abilities when joining. Any solutions?
Assuming that those are local scripts inside of startergui.
You have to create a script to check if the user has the gamepass, if so then clone the scripts to the player. Here is some example code:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) then
SpecialAbility:Clone().Parent = player.PlayerGui-- You set the parent to wherever you want
end
end
end)
end)
Yes they local scripts! So I need to create another local script and add the 2 other scripts in the new local script you wrote?
The script I made should be a server script inside of ServerScriptService.
Oh alr! And where do i type the gamepass id ? in here?(player.UserId, GamepassId) I replace GamepassId with the Id?
Yes. -------------------------
I will try it right away! thanks for your help! I will tell you if it works!
aLrighty------------------------------
What am I doing wrong?----------
Well, it looks like you have no idea about scripting.
Anyways,
- Move Character Controller and ParkourController_V1.4 to ServerStorage
- You have to define MarketPlaceService, and replace special ability with your scripts:
local MarketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 138918701) then
game:GetService("ServerStorage"):FindFirstChild("Character Controller"):Clone().Parent = player.PlayerGui
game:GetService("ServerStorage"):FindFirstChild("ParkourController_V1.4"):Clone().Parent = player.PlayerGui
end
end)
end)
Oh wow ok, I was far , no errors so far let me test
You are right I ain’t a scripter at all… But I did what you said but its not giving the abilities sadly
Have you put the scripts in server storage? And do you own the gamepass?
Yes sir! ----------------------
Alr will test --------------------
As you can see when testing nothing about the scripts in starterGui
Well, honestly I don’t know why it doesn’t work but you can try putting the scripts back in startergui and disable them, then replace the script for this:
local MarketplaceService = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 138918701) then
player.PlayerGui:WaitForChild("Character Controller").Enabled = true
player.PlayerGui:WaitForChild("ParkourController_V1.4").Enabled = true
end
end)
end)
Very strange, now yes they are visible as disable both in starterGui but they still stay disable lolll, fr, IDK why its not working cause both ways should work normally i think…
Are you sure you own the gamepass? Or maybe you’ve put the wrong gamepass id?
Yes… sadly it does not work. -------------