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

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

Asked by 7 years ago
1game.Players.LocalPlayer.Backpack:WaitForChild("Hamburger", 300)        game.Workspace.Npc.NPC.TriggerBlock.Text.Value =("Wow thanks")
2game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Value = ("Here have 100 candies! :D")
3game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Text.Value =("Bye! :)")   game.Players.LocalPlayer.leaderstats.Candy = game.Players.LocalPlayer.leaderstats.Candy+100
0
Easy: Chris75764 49 — 7y

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
7 years ago
Edited 7 years ago

Hello, Voideyz!

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

Working script:

1if 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!
2game.Workspace.Npc.NPC.TriggerBlock.Text.Value =("Wow thanks")
3    game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Value = ("Here have 100 candies! :D")
4    game.Workspace.Npc.NPC.TriggerBlock.Text.Text.Text.Value =("Bye! :)")
5    game.Players.LocalPlayer.leaderstats.Candy = game.Players.LocalPlayer.leaderstats.Candy + 100
6end

Good Luck with your games!

Ad

Answer this question