I am working on two different scripts at the moment, and neither of them seem to be working, and I cannot find the issue. (I am new to scripting, so sorry if these are dumb mistakes)
[#1 SOLVED (see #2)] 1) This first script is simple. You are supposed to click a part, and then the music plays in a certain radius. This is what I have:
function onClicked()
game.Workspace.RoomMusic.SoundBlock.Sound:Play()
print "musicplaying"
end
game.Workspace.RoomMusic.Part.ClickDetector:connect(onClicked)
I feel like the problem has something to do with the ClickDetector, as it doesn’t print when clicked.
-
The second thing I am scripting is a shower. The shower is already scripted to turn on/off, but, I want the shower to flood if it is left on too long. This is what I have so far:
Shower Script:
function onClicked()script.Parent.Parent.ShowerHead.ParticleEmitter.Enabled = true
game.Workspace.Shower.ShowerOff.Transparency = 1
game.Workspace.Shower.ShowerOff.CanCollide = false
game.Workspace.Shower.ShowerOn.Transparency = 0
game.Workspace.Shower.ShowerOn.CanCollide = true
print “showeron”game.Workspace.ShowerSoundBlock.Sound:Play()
game.Workspace.ShowerSoundBlock.Sound.MaxDistance = 15script.Parent.ClickDetector.MaxActivationDistance = 0
script.Parent.Parent.FloodingValue.Value = 1
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Flood Script:
–| If on, start flooding
if script.Parent.FloodingValue.Value == 1 then
wait(1)
script.Parent.Flood1.Transparency = 0
wait(3)
script.Parent.Flood2.Transparency = 0
wait(3)
script.Parent.Flood3.Transparency = 0
wait(3)
script.Parent.Flood4.Transparency = 0
end
–| If off, drain water
if script.Parent.FloodingValue.Value == 0 then
wait(3)
script.Parent.Flood4.Transparency = 1
wait(3)
script.Parent.Flood3.Transparency = 1
wait(3)
script.Parent.Flood2.Transparency = 1
wait(3)
script.Parent.Flood1.Transparency = 1
end
I already tested it a bit, everything prints and the IntValue does change, but the blocks (Flood1, Flood2, Flood3, Flood4) don’t become visible.
Again, sorry if these are stupid mistakes.