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

Answers needed help?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
local undebounce = true
function onTouched(hit) -- Gets hit
if undebounce then
undebounce = false
if hit.Parent.Name:lower() == "Baseball" then -- This is a tool but I tried putting handle as well still not working...
script.Parent.Text = "Foul!" -- This is in a message...
end end- Ends
wait(2)  -- Remove this if you only want the script to work once
undebounce = true -- Remove this if you only want the script to work once
end - Ends
script.Parent.Touched:connect(onTouched) -- Connects to the function

1 answer

Log in to vote
-1
Answered by 10 years ago

Well, I've updated your code with a debounce, and I think the problem is the part where it says NameOfPart, I think you have to change it to a different name.

local undebounce = true -- debounce
function onTouched(hit) --  the function's Name
if undebounce then
undebounce = false
if hit.Parent.Name:lower() == "NameOfPart" then -- I'm not sure if you forgot to change this part right here 'NameOfPart' to a different name
script.Parent.Text = "Text" --  Do you mean the Name of a Brick, Text of a Message, or the Text of a GUI?
end end -- Ends
wait(2) --Remove this if you only want script to work only once
undebounce = true --Remove this if you only want script to work only once
end -- End
script.Parent.Touched:connect(onTouched) -- connects the function
0
Not working ^ DevScripting 92 — 10y
Ad

Answer this question