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

I want to make a script so if a tool touch something u will get money but my scirpt down working?

Hello,

I want to make so if a tool touch something he will get money after some seconds! This is the script i using now that are wrong:

Money = "Cash"
GetMoneyFromTree = "100"
WaitForMoney = 10

script.Parent.Touched:connect(function(hit)
	if hit.Parent.Name == "Tool" then
		script.Parent.Anchored = false
		wait(10)
		game.Players.LocalPlayer.leaderstats[Money].Value = game.Players.LocalPlayer.leaderstats[Money].Value + 100
	end
end)

That script is wrong.

Can someone help me with this script??

1 answer

Hello, Lava_Scripter!

You don't test if a item has the name of tool(if you REALLY want this, you do)

You use :IsA("Tool") to test if part is a tool

Edited script:

Money = "Cash"
GetMoneyFromTree = "100"
WaitForMoney = 10

script.Parent.Touched:connect(function(hit)
    if hit.Parent:IsA("Tool") then
        script.Parent.Anchored = false
        wait(10)
        game.Players.LocalPlayer.leaderstats[Money].Value = game.Players.LocalPlayer.leaderstats[Money].Value + 100
    end
end)

Good Luck with your games!

1 comment

0

thx

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