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

Siren script not working when regened?Your title should be specific! Describe your proble

Asked by 3 years ago

Hello, I have a script that works when the car is running and not regened, but it doesn't work when the car regenerates. Can somebody help me figure this out?

local ambulance = game.Workspace:WaitForChild("Ambulance")
local shell = ambulance.Shell
local siren = shell["Ambulance Siren"]
script.Parent.ClickDetector.MouseClick:connect(function(player)
    siren:Stop()
end)

1 answer

Log in to vote
2
Answered by
VAHMPIN 277 Moderation Voter
3 years ago
Edited 3 years ago

You probably haven't made a script to put the script back into the car after regen

put your script:

script.Parent.ClickDetector.MouseClick:connect(function(player)
    local ambulance = game.Workspace:WaitForChild("Ambulance")
workspace.Ambulance.Shell["Ambulance Siren"]:Stop()
end)

into the model that it regenerates from

0
But it is supposed to be a button that you click then the siren goes off. squidiskool 208 — 3y
0
ah. I see. VAHMPIN 277 — 3y
0
use the script i just edited in VAHMPIN 277 — 3y
0
And I can't put the button inside the ambulance otherwise the whole game will be messed up. squidiskool 208 — 3y
View all comments (3 more)
0
use the script i just edited in as it does the script RAW meaning it doesn't take the OLD variables. VAHMPIN 277 — 3y
0
Thank you for the script, it works now. squidiskool 208 — 3y
0
No problem dude, the thing with regenerating items is that old variables don't get replaced so try to make scripts with regenerating properties RAW, good luck! VAHMPIN 277 — 3y
Ad

Answer this question