New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

[SOLVED] Can you help me on a fire alarm script?

Asked by 5 years ago

I tried everything and the script says:

16:04:18.258 - horn is not a valid member of Part
16:04:18.259 - Script 'Workspace.RFT2 Fire Alarm System.Signal1.Signals.RFS 610-MC', Line 4
16:04:18.260 - stack end
16:04:18.264 - Attempt to connect failed: Passed value is not a function
16:04:18.264 - Script 'Workspace.RFT2 Fire Alarm System.Signal1.Signals.RFS 500-EM', Line 52
16:04:18.265 - stack end
16:04:18.268 - Alarm is not a valid member of Part
Script 'Workspace.RFT2 Fire Alarm System.Script', Line 235
stack end

The script is below.

val = script.Parent.Parent.Parent.Parent.AudibleCircuit
val2 = script.Parent.Parent.Parent.Parent.VisualCircuit

horn = script.Parent.horn
strobe = script.Parent.Parent.Strobe
candela = 1

hornpitch = math.random(1690,1755)/100
horn.Pitch = hornpitch

if candela == 0 then -- 15
    strobe.Flasher.Size = UDim2.new(1.5,0,1.5,0)
elseif candela == 1 then -- 75
    strobe.Flasher.Size = UDim2.new(3.5,0,3.5,0)    
elseif candela == 2 then -- 110
    strobe.Flasher.Size = UDim2.new(4.5,0,4.5,0)    
end

function Flash()
strobe.BrickColor = BrickColor.new(1001)
strobe.Flasher.Strobe.Visible = true
wait(0.05)
strobe.BrickColor = BrickColor.new(194)
strobe.Flasher.Strobe.Visible = false
end

function Tick()
if val2.Value == 1 then
    tick:Play()
    wait(0.05)
else
    tick:Stop()
    end
end

val.Changed:connect(Sound)

function Sound()
if val.Value == 1 then
    horn:Play()
else
    horn:Stop()
end
end
end

val.Changed:connect(Sound)

function Visual()
    if val2.Value == 1 then
        Flash()
    end
end

val2.Changed:connect(Visual)

1
Are all your paths correct? Shawnyg 3935 — 5y

1 answer

Log in to vote
1
Answered by
AxeOfMen 433 Moderation Voter
5 years ago

Let's examine your first error:

16:04:18.258 - horn is not a valid member of Part
16:04:18.259 - Script 'Workspace.RFT2 Fire Alarm System.Signal1.Signals.RFS 610-MC', Line 4
16:04:18.260 - stack end

The error message is "horn is not a valid member of Part" The second line of this error message tells us that the error occurs on Line 4. Let's look at line 4:

horn = script.Parent.horn

You are trying to find an object called "horn" that is a child of the script's parent. The error is telling you that the script.Parent does not have a child named "horn". To fix this error you need to modify line 4 to find where "horn" really is.

0
After I got rid of "val.Changed:connect(Sound)", it works. Thank you very much! firealarmtech199 0 — 5y
Ad

Answer this question