How to make a 2x strength gamepass for my tool right now it gives 10 strength every click without gamepass
You could make an bool value to be checked true/false if the player have the gamepass or not.
I didn’t checked it but I think it will work
Put in ServerScriptService
local MS = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(plr)
if MS:UserOwnsGamePassAsync(plr.userId, 18144721) or plr.Name == "" then
-- and you should fire event here
end
end)
end)
Mind sharing the tool’s script?
Due to the fact you have not got the tool code for context, this is all I can do:
local m = game:GetService("MarketplaceService") -- Marketplace Service variable.
local gamepassId = 0 -- Type your gamepass id here.
local strengthPower = 10 -- I put ten since you specified the tool gained 10 strength per hit.
game.ReplicatedStorage.RemoteEventNameGoesHere.OnServerEvent:Connect(function(x) -- When the RemoteEvent is fired...
-- Your tools main code below v
-- Code goes here!
-- Your tools main code above ^
-- Now once you are at the point in the code that the strength gets given use this code below v
if m:UserOwnsGamePassAsync(x.UserId, gamepassId) then -- If the player owns the gamepass then...
strengthPower = strengthPower * 2 -- multiply strength value by 2.
wait()
-- [Your strength variable.Value] == [strengthPower]
else
-- [Your strength variable.Value] == [strengthPower], yes I know the code is the same as the above, however the strength variable will be different because if they have the gamepass it will now be 20 instead of 10.
end
end)
This code goes in a plain script not a local or module script, you then add the rest of your code in between the comments where I have pointed out.