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

Why is the detector detecting these parts before they even get touched?

Here is a GIF: GIF (In the GIF the detector is the RED brick) And the code:

script.Parent.Touched:connect(function(part)
if part.Name=="Music" then
game.Workspace.Missed.Value=game.Workspace.Missed.Value+1
part:Destroy()
end
end)

All the parts are named music... so why is it detecting early?

3 comments

0

It could be the difference in time between the detector signaling the event and the Roblox client updating the viewport. Try lowering the speed of the "Music" parts and see if they make it closer to the bar.

0

@KIdTech101 It still doesn't make it much clsoer

0

If not already, you should handle this on the client side.

1 answer

I recomend you adding a "WaitForChild" event so the script will run when the child name gets touched.

Example:

script.Parent.Touched:connect(function(part) part:WaitForChild("Music") if part.Name == "Music" then game.Workspace.Missed.Value=game.Workspace.Missed.Value+1 part:Destroy() --Don't forget to remove the end without the ")" end)

That should fix your problem. BUT in case that doesn't work, try adding a "FindFirstChild" event so the script will run when the child name "Music" is found.

script.Parent.Touched:connect(function(part) part:FindFirstChild("Music") if part.Name == "Music" then game.Workspace.Missed.Value=game.Workspace.Missed.Value+1 part:Destroy() --Don't forget to remove the end without the ")" end)

That should fix your problem either.

If none of these work, then try on a local script (99% sure it won't work but worth the try, eh?)

And If that doesn't work ask someone else ;-;

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