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

? I Have A Script That Detects If Someone Has An Item In Their Inventory. [More Info In Desc]

I Have A Script That Detects If Someone Has An Item In Their Inventory. The Only Thing Is, It Checks If They Have The Item In Their Inventory, If They Do, Nothing Happens But If They Don't, They Get An Item. The Only Thing Is, Players Can Bypass This By Equipping The Item First. Is there Anyway To Stop This?

local enabled = true

game.Players.PlayerAdded:Connect(function(p)
	script.Parent.Touched:Connect(function()
		if not p.Backpack:FindFirstChild("InfluencerLauncher") or p.Character.InfluencerLauncher then
			if enabled == true then
				game.ServerStorage.InfluencerLauncher:Clone().Parent = p.Backpack
				enabled = false
				script.Parent.Transparency = 1
				wait(30)
				enabled = true
				script.Parent.Transparency = 0
			end
		end
	end)
end)

1 answer

✓ Accepted answer

This should work.

local enabled = true

game.Players.PlayerAdded:Connect(function(p)
	
	script.Parent.Touched:Connect(function(hit)

		local character = hit.Parent

		if not p.Backpack:FindFirstChild("InfluencerLauncher") and not character:FindFirstChild("InfluencerLauncher") then

			if enabled == true then
			game.ServerStorage.InfluencerLauncher:Clone().Parent = p.Backpack

			enabled = false
			script.Parent.Transparency = 1

			wait(30)

			enabled = true
			script.Parent.Transparency = 0

			end
		end
	end)
end)

5 comments

0

It seems to still let me get the item when it is equipped.

1

Did you copy from the source? Because when I test it, it works fine. Doesn't give me the item when I have it in my player or character, but then gives it to me if I don't have the item.

1

Here's also a Gyazo GIF of it working for me: https://gyazo.com/db36902278ee7e572d1550fddc006aed

0

Sorry I managed to fix it thanks.

1

No problem, happy to help.

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