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 6 years ago
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

0
Easy: Chris75764 49 — 6y

1 answer

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

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!

Ad

Answer this question