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

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

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

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

2 comments

0

I tried that

0

In that case I have no idea.

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