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

Is there a way to make this event to happen for only the player who got this specific tool?

game.Players.LocalPlayer.Backpack:WaitForChild("Hamburger", 300)	 	game.Workspace.Npc.NPC.TriggerBlock.Text.Value =("Wow thanks")
game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Value = ("Here have 100 candies! :D")
game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Text.Value =("Bye! :)")	game.Players.LocalPlayer.leaderstats.Candy = game.Players.LocalPlayer.leaderstats.Candy+100

1 comment

0

Easy:

1 answer

Hello, Voideyz!

To find a thing on a part, you must use a if and :FindFirstChild()!

Working script:

if game.Players.LocalPlayer.Backpack:FindFirstChild("Hamburger", 300) or game.Workspace[ game.Players.LocalPlayer.Name]:FindFirstChild("Hamburger", 300) then -- the "game.Workspace[ game.Players.LocalPlayer.Name]:FindFirstChild("Hamburger", 300)" is to detect even if player is holding the item!
game.Workspace.Npc.NPC.TriggerBlock.Text.Value =("Wow thanks")
	game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Value = ("Here have 100 candies! :D")
	game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Text.Value =("Bye! :)")
	game.Players.LocalPlayer.leaderstats.Candy = game.Players.LocalPlayer.leaderstats.Candy + 100
end

Good Luck with your games!

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