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

Why does this whole function not execute?

Asked by 5 years ago
Edited 5 years ago

Hi, so I'm trying to get this engine spool script to work, but all it does is print "debug1", and not go past the "if script.Parent.Throttle.Value > 0.01 then" line of code. I've made sure the throttle value is working, and it is. The "script.Parent.Normal.Pitch" audio is activated by another script, so that's not the issue either. It doesn't print "debug2". The "--Server" and "--Local" scripts are two separate scripts.

```lua --Local local ReplicatedStorage = game:GetService("ReplicatedStorage") local engineSpool = ReplicatedStorage:WaitForChild("EngineSpool")

while wait(0.03) do if script.Parent.Throttle.Value > 0.01 then print("Spool Started") engineSpool:FireServer() end end

--Server local ReplicatedStorage = game:GetService("ReplicatedStorage") local engineSpool = Instance.new("RemoteEvent", ReplicatedStorage) engineSpool.Name = "EngineSpool"

local function onEngineSpool() print("debug1") if script.Parent.Throttle.Value > 0.01 then print("debug2") script.Parent.Normal.Pitch = script.Parent.BasePitch.Value + (script.Parent.MaxPitch.Value-script.Parent.BasePitch.Value)*script.Parent.Throttle.Value else script.Parent.Normal.Pitch = script.Parent.BasePitch.Value end if script.Parent.Throttle.Value > 0.8 then script.Parent.Buzzsaw:Play() else script.Parent.Buzzsaw:Stop() end end engineSpool.OnServerEvent:Connect(onEngineSpool)

0
Changes on the Client will not Replicate to the Server, make sure your Remote Events are taking into account the changed Values SerpentineKing 3885 — 5y
0
What do you mean? The whole "onEngineSpool()" function is being fired by the RemoteEvent. roblox245688679934 18 — 5y

Answer this question