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

Script was moved from a GUI to a part and now it no longer works??

Asked by 5 years ago

This script is being thoroughly annoying right now. I had a setup that worked very well where the script was inside of the intro GUI and when you pressed the play button it would lead to the turn signal turning on any time you pressed Z. The script referenced 'AccordWagon' many times (the name of the folder that the body is a child of, which all of the panels are children of, etc, etc) and I realized that, should my game actually take off, there may be multiple AccordWagons at a time, which would surely cause chaos, so I decided that I had to move the script into the car itself and reference script.Parent rather than game.Workspace.AccordWagon. The script is now being very confusing and annoying, it is not working whatsoever. I figured that I must have forgot to replace something with 'script.Parent', but I don't see any instances of that occurring. I put a few print statements in to see where the script was derailing, but that led me to the conclusion that the script is not running at all, as no print statements ever showed up in the output, even after making one the first line of the script. I hope you can follow what I'm saying and I hope you can see that I have no clue what is going on and why the script suddenly isn't working. Here's the script in question...

print("Script is running") --Not showing up in output
local HondaAccordWagon = script.Parent.Parent.Parent
game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui').ScreenGui.Frame.TextButton.MouseButton1Click:Connect(function()
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.Z then
    print("It works!") --Not showing up in output
            game.Workspace.TurnSignal:Play()
            game.Workspace.TurnSignal.Looped = not game.Workspace.TurnSignal.Looped
            script.Parent.Value.Value = not HondaAccordWagon.LeftTurn.LeftTurnSignal.Value.Value
            if script.Parent.Value.Value == true then
            while true do
                    script.Parent.Enabled = true
                    HondaAccordWagon.LeftTurn2.LeftTurnSignal2.Enabled = true
                    wait(0.3)
                    script.Parent.Enabled = false
                    HondaAccordWagon.LeftTurn2.LeftTurnSignal2.Enabled = false
                    wait(0.3)
            if script.Parent.Value.Value == false then
                break
            end
            end
            end
            end
end)
end)


0
is the script a localscript Questofmagicfarts 55 — 5y

Answer this question