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

How to activate a script by using onTouched()?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
  • 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);
0
This didn't do much. "Sound" is actually a script, not a sound. Sorry for the confusion ;p kitty2_0 0 — 3y
0
local Sound= script.Sound; -- If the script is inside the this script parent Sound.Disabled = false; Hieroglyphica 0 — 3y
0
why are you giong to use another script when you can just use one? ragdollkiiing2 19 — 3y
0
Hey, don't ask me! Ask the person who wanted this. Hieroglyphica 0 — 3y
Ad

Answer this question