I made a door that make sound when someone click on it. And I also added in a code that when someone say like "open up" the door will open, but it's not working. Can someone help me?
Here is my door and script layout so it's easier to know what I'm talking about:
https://gyazo.com/d9201224b982036726ea59de40e8b3e1
And my script is down below:
Brick = script.Parent Sound = Brick.Sound Debounce = false function onClicked() if not Debounce then -- If the debounce is false Debounce = true -- Change it to true Sound:Play() wait(Sound.TimeLength) -- Wait til it ends Debounce = false -- Change it to false end -- End the if function end script.Parent.ClickDetector.MouseClick:connect(onClicked) door = script.Parent --this is the door function onChatted(msg, recipient, speaker) -- convert to all lower case local source = string.lower(speaker.Name) msg = string.lower(msg) if (msg == "open up") then door.CanCollide = false door.Transparency = 0.7 wait(5) door.CanCollide = true door.Transparency = 0 end end function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end game.Players.ChildAdded:connect(onPlayerEntered)
The problem may be due to the fact that you're using a LocalScript, I'd recommend using normal scripts when they are being run serverside.