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

How would I make the tool detect the player that is using the tool?

Asked by
Nump4d 5
4 years ago
local db = true
script.Parent.Touched:connect(function(hit)
    if hit.Name == "pickuparea" then game.Players:FindFirstChild("Humanoid")
        if db == true then
            db = false
            script.Parent.Transparency = 1
            local player = script.Parent.Touched
            player.leaderstats.Robux.Value = player.leaderstats.Robux.Value + 10
            script.Parent.Sound:Play()
            script.Parent.Transparency = 1
            wait(60)
            db = true
            script.Parent.Transparency = 0
        end
    end 
end)

I need the script to detect the player that is using the tool, so that the player can be rewarded with currency. I need help ASAP and it will be greatly appreciated

0
A thing you need to get noticed, don't use ROBUX as your stat name. A popular tycoon maker got banned by doing a ROBUX tycoon, that give people think the tycoon really gives ROBUX. so, honestly, just do it to Money, cash, or coins. Thanks, and sorry that I posted something that not suit to this helping website. Xapelize 2658 — 4y

1 answer

Log in to vote
0
Answered by
rpg523 13
4 years ago
Edited 4 years ago

Edit :

From what I understand, you want the part of the tool, in this case the "handle", to touch the object and the player earn an amount of money.

So that's it here :


script.Parent.Touched:Connect(function(hit) if hit.Parent.Name == "Tool" then local findplayer = game.Players:FindFirstChild(hit.Parent.Parent.Name) if findplayer ~= nil then findplayer.leaderstats.Robux.Value = findplayer.leaderstats.Robux.Value + 1 end end end)
0
This works, but how would i make it to where when the part of the tool touches the object, it gives you currency? Nump4d 5 — 4y
0
I edited the comment, see if that's it rpg523 13 — 4y
Ad

Answer this question