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

Tools tool not working as a tools but working as tool?

Asked by 6 years ago

My script has a blue underline under tools. The script is giving me one sand with tools when you should get two. Can this be fixed?

script.Parent.Touched:connect(function(part)
    if part.Parent:IsA("Tool") and game.Players:FindFirstChild(part.Parent.Parent.Name) then
        local plr = game.Players:findFirstChild(part.Parent.Parent.Name)
        wait(1)
        plr.leaderstats.Sand.Value = plr.leaderstats.Sand.Value + 1
        script.Parent:Destroy()
    end
end)
script.Parent.Touched:connect(function(part)
    if part.Parent:IsA("Tools") and game.Players:FindFirstChild(part.Parent.Parent.Name) then
        local plr = game.Players:findFirstChild(part.Parent.Parent.Name)
        wait(.1)
        plr.leaderstats.Sand.Value = plr.leaderstats.Sand.Value + 2
        script.Parent:Destroy()
    end
end)

0
"Tools" don't exist, this may be the name Leamir 3138 — 6y
0
not the name I changed it to hi still not working ootheboss 32 — 6y
0
I'm having a tough time understanding what you are asking. The function IsA takes in a class name and tools is not one of them. Are you trying to get the name? In that case don't use a function, but instead the equality test operator (==) and compare the name to your name. NuclearTheNoob 30 — 6y
0
I'm confused too... ootheboss 32 — 6y

Answer this question