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

if statement uses 2 ends!?!?!?

Asked by 4 years ago

Alright, so i want you to look at where the function at line 19 is, and then copy paste all the code into studio. Pressing enter by the "end" on line 38 will cause studio to incorrectly indent the next line. wth?

--Variables
Character = script.Parent
Stand = game:GetService("ServerStorage").Stand:Clone() -- Makes a new Stand
Stand.Parent = Character
UserInputService = game:GetService("UserInputService")
XStandOriginalPosition = Character.PrimaryPart.Position.x + 1
YStandOriginalPosition = Character.PrimaryPart.Position.y + 1
ZStandOriginalPosition = Character.PrimaryPart.Position.z - 3

--Welding the stand to the user
Stand:MoveTo(Vector3.new(XStandOriginalPosition,YStandOriginalPosition,ZStandOriginalPosition)) --Moves the Stand relative to the user
UserWeld = Instance.new("WeldConstraint") --Makes a weld to the user and teh stand
UserWeld.Name = "UserWeld"
UserWeld.Parent = Stand
UserWeld.Part0 = Stand.HumanoidRootPart
UserWeld.Part1 = Character.HumanoidRootPart

--Toggle the Stand
UserInputService.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Q and Stand.Humanoid.StandOut == true then
        Stand:MoveTo(Character.PrimaryPart.Position)
        local function SetModelTransparency(Model,Transparency) --Make a function that will make the stand transparent
            for _,Part in pairs(Model:GetDescendants()) do
                if Part:IsA("BasePart") then
                    Part.Transparency = 1
                end
            end
        end
    else
        Stand:MoveoTo(XStandOriginalPosition,YStandOriginalPosition,ZStandOriginalPosition)
        local function SetModelTransparency(Model,Transparency) --Makes a function to set the transparency of the stand again but makes it opaque
            for _,Part in pairs(Model:GetDescendants()) do
                if Part:IsA("BasePart") then
                    Part.Transparency = 0
                end
            end
        end
    end --Pressing enter over here will make an incorrect indent. the if statement just below the function will consume both ends of the if statement AND the function when i try to close the if statement, and the function at the top doesnt close anything when i try because it has no end to cap off, and when i try to add more ends and )'s it gives me the error of needing a ) or requiring to remove the additional end.
end)

This is probably a bug and i've seen this very same bug on another forum page. It said this was fixed but it's happening AGAIN. I'm pulling my hairs out and biting my desk. I thank you and appreciate the time you spend helping me on this very much.

0
hey there the line 32 should be at the same altitude as like 31 so there is no end at line 35 TheRealPotatoChips 793 — 4y
0
i dont know how that would help but ive tried everything and it didnt work but i came up with something. gartfart36 5 — 4y

Answer this question