Yea if its not inside a while loop or some Changed event it wont work because it will prob only check once
If i put it in a changed event it doesnt even play the music though what should i do?
Does the changed event work? Does it print anything?
Ok what?! Now it works all of the sudden! But i had to jump out the car and jump back in for it to play the music it iddnt print “play” when i jumped in the first time but the second time it printed it and played the music the stop works fine now though!
You Can Use:
while seat.Occupant == false then
RBR:Stop()
RBR:Looped = false
end
Where at though?
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if seat.Occupant then
print("Play")
CD:Play()
wait(5)
RBR:Play()
RBR.Looped = true
else
print("Stop")
RBR.Looped = false
RBR:Stop()
end
while wait() do
if seat.Occupant and not CD.Playing and not RBR.Playing then
CD:Play()
RBR:Play()
elseif not seat.Occupant then
RBR:Stop()
CD:Stop()
end
end
If you want them to loop then you can just change the Looped property in the sound object.
This way it checks if the sound is already playing and doesn’t keep repeating the first second of the song.
this works for me
car.DriveSeat.Changed:connect(function(property)
if property == "Occupant" then
if car.DriveSeat.Occupant then
car.EngineBlock.Running:Play()
else
car.EngineBlock.Running:Stop()
end
end
end)
So in your case:
seat.Changed:connect(function(property)
if property == "Occupant" then
if seat.Occupant then
print("Play")
CD:Play()
wait(5)
RBR:Play()
RBR.Looped = true
else
print("Stop")
RBR.Looped = false
RBR:Stop()
end
end
end)
Just add the other things you want into that and it should run when it’s supposed to.
It works when you get into the car a second time for some reason.
Also it overlaps the music and keeps replaying it over and over.
That’s really odd. For me it works.
Could it possibly be other code interfering with it?
I doubt it but there is another line of code using the seat.occupant getpropertychangedsignal
If that line is doing anything with de audios try commenting out some lines using --
This is the only line doing anything with audios the others are just varibles
Do this and maybe it’ll work?
seat.Touched:Connect(function()
RBR:Play()
RBR.Looped = true
end)
seat.TouchedEnded:Connect(function()
RBR:Stop()
RBR.Looped = false
end)
Found a fix! turns out i had to just put it before all the other code right after the varibles!