Hello there,
havent posted in a while, but yeah.
I am making a tank script, and when it accelerates the playback speed changes. But it prints out nothing, even printing “changed” doesnt work.
It always says a error so i made it that the speed is a value,
this is the one for the speed value.
local spd = script.Parent.Parent.Parent.Base.Velocity.Magnitude
while true do
wait(0.1)
script.Parent.Value = spd
end
This seems to be working, but this is the localscript under the sound.
local spd = script.Parent.Parent.Speed
spd.Changed:Connect(function(spdd)
local spddd = tonumber(spdd)
local spdddd = spddd / 48
print("changed")
script.Parent.Parent.IDLE_SFX_TANK.PlaybackSpeed = spdddd
script.Parent.Parent.IDLE_SFX_TANK:Pause()
wait(0.1)
script.Parent.Parent.IDLE_SFX_TANK:Play()
end)
btw it doenst matter if it is played or not it still doenst work
These are the locations.
Can someone help, thanks!
Nice day!
1 Like
jaymeyzy
(jaymey)
August 2, 2023, 8:39pm
#2
Local scripts can’t run in workspace, are you sure the first script is working?
jaymeyzy
(jaymey)
August 2, 2023, 8:40pm
#3
You can try moving the second localscript into starter player scripts and see if that changes anything.
Hapun
(Hapun)
August 3, 2023, 11:22am
#5
I’d transition this over to a regular Script.
local basePlayback = 0.6
game:GetService("RunService").Heartbeat:Connect(function()
local velocity = seat.AssemblyLinearVelocity.Magnitude
seat.Engine.PlaybackSpeed = (velocity / seat.MaxSpeed) + basePlayback
end)
Taken from some old vehicle code of mine, so I’m not sure how practical the use of RunService is.
You’ll have to change the variables accordingly, and you can also tweak the basePlayback
variable to set the base speed the audio will play at.
system
(system)
Closed
August 24, 2023, 12:03pm
#7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.