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

How to activate a script by using onTouched()?

This is the script I have come up with, I want to activate "sound", which "is already in the same part as this script. I am getting warned "Unknown Global Sound". I apologize if this may seem stupid, brand new to this stuff.

function onTouched()
	local script = Sound
	Sound.Disabled = false
end

script.Parent.Touched:Connect (onTouched)

1 answer

  • There was some typing errors.
 function onTouched()
    local Sound= script.Sound; -- If the script is inside the this script parent
    Sound.Disabled = false;
end
 
script.Parent.Touched:Connect(onTouched);

4 comments

0

This didn't do much. "Sound" is actually a script, not a sound. Sorry for the confusion ;p

0

local Sound= script.Sound; -- If the script is inside the this script parent Sound.Disabled = false;

0

why are you giong to use another script when you can just use one?

0

Hey, don't ask me! Ask the person who wanted this.

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