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

How do I make a script that plays a sound when moving while in vehicle seat?

Asked by 2 years ago
Edited 2 years ago

I tried making a script that plays a sound when moving while in a vehicle seat, but it isn't working so help is appreciated.

Script:

while wait() do
    if script.Parent.Throttle == 1 then
        script.Parent.Run:Play()
    else
        script.Parent.Run:Pause()
    end
end
0
you got there a sounds thing frjhue 2 — 2y
0
Never use wait() it's really bad for performance instead use game.RunService.Heartbeat:Wait() waiting for events to be fired is a lot better. There's always an event for different situations. Is this your entire script? MarkedTomato 810 — 2y
0
i gave you an answer Xyternal 247 — 2y

1 answer

Log in to vote
0
Answered by
Xyternal 247 Moderation Voter
2 years ago
Edited 2 years ago

I really don't know, or think this is the best way of over coming your problem, but you can just check to see if the player is touching the part I guess. Put this script in your seat, and put your sound script where it says in this script.




local seat= script.Parent local function onTouch(otherPart) local character = otherPart.Parent local humanoid = character:FindFirstChildWhichIsA("Humanoid") if humanoid then ---your sound script. end end seat.Touched:Connect(onTouch)
0
I am new to scripting so I don't know how DivineGodLike 0 — 2y
Ad

Answer this question