Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a giver give a game pass tool, else give a regular tool?

deb = false

timeuntilcantouchagain = 3

script.Parent.Touched:connect(function(thing)
p = game.Players:FindFirstChild(thing.Parent.Name)
s = game.Lighting:findFirstChild("Thumper")
if p and s and not deb then
deb = true
s:clone().Parent = p.Backpack
wait(timeuntilcantouchagain)
deb = false
end
end)

If this is my script for just a regular giver, how do i make it so that if a player has a game pass, it doesn't give that, but it gives the other tool.

So I'm guessing it would be something like this:

*Checks for pass *If has pass *Give GThumper (Golden Thumper) *Else *Give Thumper (Regular thumper) *End

1 answer

✓ Accepted answer

You would do this:


local passId =  0000000 -- Change this to your game pass' ID 
local GPS = game:GetService("GamePassService")
local lighting = game.Lighting 
local thumper  = {lighting.Thumper, lighting.GThumper}
script.Parent.Touched:connect(function(part)
if game.Players:FindFirstChild(part.Parent.Name) then
local player  = game.Players[part.Parent.Name]
if GPS:PlayerHasPass(player, passId)  then
 if not player.Backpack[thumper[2].Name] or player.StarterGear[thumper[2].Name] then
thumper[2]:Clone().Parent = player.Backpack 
thumper[2]:Clone().Parent = player.StarterGear
end
else 

 if not player.Backpack[thumper[1].Name] and player.StarterGear[thumper[1].Name] then
thumper[1]:Clone().Parent = player.Backpack 
thumper[1]:Clone().Parent = player.StarterGear
end
end
end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.