Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago
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

Log in to vote
0
Answered by 8 years ago

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)
Ad

Answer this question