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

Expected '=' when parsing assignment, got 'Skip' what does this mean?

Asked by
JMC0077 -4
4 years ago

hi, i'm following a tutorial on how to make a custom NPC chat system and the script does not work and I do not know why

local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")








local DetectedNPC = nil
local Detected = false
local Chatting = false
local Skip = false
local Exit = false








local Player = Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera

local Gui = script.Parent
local Sounds = Gui.Sounds
local PromptLabel = Gui.PromptLabel
local LineLabel = Gui.LineLabel








local Character = Player.Character or Player.CharacterAdded:Wait()
local CharHMR = Character:WaitForChild("HumanoidRootPart")








local NPCS = game.Workspace:WaitForChild("NPCS")








UIS.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.X then
        if Chatting == true then
            Skip = true
            Sounds.Click:Play()
        end
    end
end)

UIS.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.Z then
        if Chatting == true then
            Exit = true
            Sounds.Click:Play()
        end
    end
end)

UIS.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.E then


        if Detected == true then
            local Lines = DetectedNPC:FindFirstChild("Lines")

            if Lines then
                Sounds.Click:Play()

                Chatting = true
                Detected = false

                LineLabel.Text = " "

                Promptlabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear")
                LineLabel:TweenPosition(UDim2.new(0, 0, 0.8, 0), "In", "Linear")

                wait(0.5)

                for i, Line in pairs(Lines:GetChildren())do
                    local Text = Line.Value

                    for i = 1, #Text do
                        LineLabel.Text = string.sub(Text, 1, i)
                        Sounds.Talk:Play()
                        if Skip == true then
                            Skip = false
                            LineLabel.Text = Text
                            break
                        end
                        if Exit == true then
                            break
                        end
                        wait(0.07)
                    end
                    if Exit == true then
                        Exit = false
                        break
                    end
                    repeat wait() unitl Skip == true or Exit == true
                    Skip = false
                end

                Exit = false
                Skip = false

                Promptlabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear")
                LineLabel:TweenPosition(UDim2.new(0, 0, 1.2, 0), "In", "Linear")

                wait(0.5)

                Chatting = false
                Detected = false
            end
        end
    end
end)






RunService.RenderStepped:Connect(function()


    if Detected == false and Chatting == fake then
        for i, NPC in pairs(NPCS:GetChildren())do
            local Humanoid = NPC:FindFirstCHild("Humanoid")
            local HMR = NPC:FindFirstCHild("HumanoidRootPart")

            if Humanoid and HMR then
                if (HMR.Position = CharHMR.Position).magnitude < 15 then
                    Detected = true
                    DetectedNPC = NPC
                    Promptlabel:TweenSize(UDim2.new(0, 60, 0, 60), "In", "Linear")
                    print("NPC.Name")
                end
            end

        end
    end

    if Detected == true and Chatting == false then
        local Humanoid = NPC:FindFirstCHild("Humanoid")
        local HMR = NPC:FindFirstCHild("HumanoidRootPart")

        if Humanoid and HMR then
            if (HMR.Position = CharHMR.Position).magnitude < 15 then
                Detected = false
                DetectedNPC = nil
                Promptlabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear")
                print("No Longer Detected NPC")
            else 
                local WTSP = Camera:WorldToScreenPoint(HMR.Position)
                PromptLabel.Position = UDim2.new(0, WTSP.X, 0, WTSP.Y)
            end
        end
    end

    if Chatting == true then
    local Humanoid = NPC:FindFirstCHild("Humanoid")
        local HMR = NPC:FindFirstCHild("HumanoidRootPart")

        if Humanoid and HMR then
            Camera.CameraType = Enum.CameraType.Scriptable
            Camera.Cframe = Camera.Cframe:Lerp(HMR.CFrame * Cframe.new(-4, 4, -7) * CFrame.fromOrientation(math.rad(-20, math.rad(215), 0), 0.07)
        end
    else
        Camera.CameraType = Enum.CameraType.Scriptable.Custom
    end


end)

1 answer

Log in to vote
0
Answered by 4 years ago

On line 117:

repeat wait() unitl Skip == true or Exit == true

You have a spelling mistake. unitl should be until. Could this be causing your error?

0
HAHA probably JMC0077 -4 — 4y
0
so I fixed that.. now it says "Expected ')' (to close '(' at column 7), got '='" JMC0077 -4 — 4y
0
on line 150 (sorry forgot to mention that) JMC0077 -4 — 4y
0
It seems like line 150 should be "if (HMR.Position - CharHMR.Position).magnitude < 15 then". You had an equals sign vector3_zero 1056 — 4y
View all comments (16 more)
0
ah okay JMC0077 -4 — 4y
0
now it is telling me "Expected ')' (to close '(' at line 184), got 'end'" on line 185 JMC0077 -4 — 4y
0
Change line 184 to "Camera.Cframe = Camera.Cframe:Lerp(HMR.CFrame * Cframe.new(-4, 4, -7) * CFrame.fromOrientation(math.rad(-20), math.rad(215), 0), 0.07)". You were missing a parenthesis vector3_zero 1056 — 4y
0
i think this might be the last error- "Custom is not a valid member" on line 187 JMC0077 -4 — 4y
0
Scriptable and Custom are both CameraTypes - which one did you want to set the camera to? It should either be Enum.CameraType.Scriptable or Enum.CameraType.Custom vector3_zero 1056 — 4y
0
Looking at the rest of the code i'm guessing it's probably Enum.CameraType.Custom vector3_zero 1056 — 4y
0
lets see what happens JMC0077 -4 — 4y
0
fixing some bugs.. JMC0077 -4 — 4y
0
I don't see any blue underlines, errors, or anything like that. output is fine, everything is fine. I think I have to publish the game and see if it works because in studio it is not working but the output is fine JMC0077 -4 — 4y
0
Sounds good. If i've answered your question it would be great if you could mark it as answered. vector3_zero 1056 — 4y
0
yeah does not work when actually in game JMC0077 -4 — 4y
0
everything is fine. should I post updated script? JMC0077 -4 — 4y
0
You should post a new question. I'm not here for much longer, but others might be able to look at it. vector3_zero 1056 — 4y
0
its so weird how the script and output is fine but doesn't work JMC0077 -4 — 4y
0
alright JMC0077 -4 — 4y
0
Not sure if this is the problem, but on line 144 you have "Chatting == fake" which should be "Chatting == false" vector3_zero 1056 — 4y
Ad

Answer this question