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

[Tool] I have no Idea Whats Wrong Please Help?

Asked by 10 years ago

Bubble script for a tool No Output

local bubble = script.Parent

bubble.Touched:connect(function(hit)

    if hit:FindFirstChild("Value") and hit.Value == 30 then
        hit:Destroy()
        print(hit.Name)
    end

    bubble:remove()
end)


1 answer

Log in to vote
0
Answered by
bobder2 135
10 years ago

It's probably because you are searching the part that the bubble hit for a value, rather than a character or something like that.

bubble.Touched:connect(function(hit)

    if hit:FindFirstChild("Value") and hit.Value == 30 then
        hit:Destroy()
        print(hit.Name)
    end

    bubble:remove()
end)

if hit:FindFirstChild("Value") and hit.Value == 30 then

This line checks the part that touched the bubble for an object named "Value", if "Value" is parented to a character and you are waiting for a player to hit the bubble, then you need to change that line to this:

if hit.Parent:FindFirstChild("Value") and hit.Parent:FindFirstChild("Value").Value == 30 then

0
I tried that Timster111 25 — 10y
0
In that case I have no idea. bobder2 135 — 10y
Ad

Answer this question