-3

so when i checked out my code this is what happend in errors 00:57:46.354 - Players.thetoganbear.PlayerGui.test.npc_chat:202: Expected ')' (to close '(' at line 154), got 'else' it now changed to 01:17:30.634 - Players.thetoganbear.PlayerGui.test.npc_chat:202: Expected ')' (to close '(' at line 154), got '('

--// npc chat sytem: Gui usage: tweening, camera manupulation, variable Switching 





--// Services


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




--// Main Variables



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





--// Player 


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

local Gui = script.Parent 
local Sounds = Gui.sounds 
local Promtlabel = Gui.PromtLabel 
local LineLable = Gui.LineLable 





--// Character 


local Character = Player.Character or Player.CharcterAdded:wait()
local CharHMR = Character:waitforchild("Humanoidrootpart") 





--// NPC 


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





--// Functions 


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()
            if lines then 
                Sounds.Click.Play()
                
                Chatting = true
                Detected = false
                
                LineLable.text = " "
                
                Promtlabel:TweeningSize(UDim2.new(0, 0, 0, 0), "Out", "linear")
                LineLable:Tweenpostion(UDim2.new(0, 0, 0.8, 0), "In", "linear")
                wait(0.5)
                
                for i, Line in pairs(Lines:GetChildren()) do 
                    
                    local Text = Line.Vaule
                    for i = 1, #Text do 
                        LineLable.Text = string.sub(Text, 1, i)
                        Sounds.Talk.play()
                        if skip == true then 
                            Skip = false 
                            LineLable.Text = Text
                            break
                        end
                        if Exit ==true then 
                            break 
                        end
                        wait(0.07)
                    end
                    if Exit == true then 
                        Exit = false 
                        break
                    end
                    repeat wait() until Skip == true or exit == true
                    Skip = false 
                end
                Exit = false 
                Skip = false
                
                Promtlabel:TweeningSize(UDim2.new(0, 0, 0, 0), "Out", "linear")
                LineLable:Tweenpostion(UDim2.new(0, 0, 0.8, 0), "In", "linear")
                
                wait(0.5)
                
                Chatting = false
                Detected =- false 
            end
        end
    end
end)





--// main loop 
 

RunService.Renderstepped:connect (function()
end)



if detected == falsed and chating == false  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.posititon - CharHMR.position) .magnitude < 15 then 
                Detected = true 
                DetectedNPC = NPC
                Promtlabel:TweeningSize(UDim2.new(0, 60, 0, 60), "In", "linear")
                print(DetectedNPC.Name)
                                    
                end
                
            end
        end
    if Detected == true and Chatting == false then 
        local Humanoid = NPC:FindFirstChild("Humanoid")
        local HMR = DetectedNPC:FindFirstChild("Humanoidrootpart")
        
        if Humanoid and HMR then 
            if(HMR.posititon - CharHMR.position) .magnitude > 15 then
                Detected = false 
                Detected = NPC
                Promtlabel:TweeningSize(UDim2.new(0, 0, 0, 0), "Out", "linear")
                Print ("No Longer Detected NPC")
            else
                local WTSP =  Camera:WorldToScreenPoint(HMR.postion)
                PromptLabel.postion = UDim2.new(0, WTSP.X, 0, WTPS.Y)
            end
            end
        end 
        

end



if Chatting ==  true then  end
        if Humanoid and HMR then end
            
        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.Custom
end
Wesley Smith
  • 17,890
  • 15
  • 70
  • 121
  • It means you've got a syntax error somewhere in your code. Reading the error, you're most likely missing a `)` somewhere. – Wesley Smith Sep 27 '20 at 05:07
  • 1
    Thank you a lot I am going to see if this works and if it doesn't then I will be back – Green Zombie Sep 27 '20 at 05:12
  • hi Wesley Smith it changed a bit im sorry im really new to coding 01:17:30.634 - Players.thetoganbear.PlayerGui.test.npc_chat:202: Expected ')' (to close '(' at line 154), got '(' that is what it changed to so do i go to line 154 or line 202 im also using lua – Green Zombie Sep 27 '20 at 05:20
  • It seems there's still another syntax error in the code. What editor are you using to write your code? Generally a good IDE will highlight such errors for you. Perhaps you could post the code here? – Wesley Smith Sep 27 '20 at 05:23
  • ok i will try to post the code give me a second also does ide cost money because i need something free thank you for helping me – Green Zombie Sep 27 '20 at 05:25
  • i have a little problem it wont let me post my code also thank you for sticking through with my problem – Green Zombie Sep 27 '20 at 05:30
  • Hmm, odd, perhaps you could post it here https://repl.it/languages/lua, save it, and provide the link? It might even be enough to show you where the issue is – Wesley Smith Sep 27 '20 at 05:31
  • I GOT IT https://repl.it/repls/ModernBustlingAutomaticparallelization – Green Zombie Sep 27 '20 at 05:40
  • im also coding with the roblox script thing to help my friend with a game he is making – Green Zombie Sep 27 '20 at 05:40
  • 1
    Please provide your code, along with error and your expected result See [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) – Shivam Jha Sep 27 '20 at 07:34
  • check your pairs. you have mismatching ends and parenthesis. – Piglet Sep 27 '20 at 08:56

1 Answers1

0

you forgot to close a parentesis

example:

 -- Expected ')' (to close '(' error

 players.PlayerAdded:Connect(function(player) -- start scope
   
 end -- end scope < you must close the scope here with an ")" e.g:  end)
rufi
  • 1