Roblox Combat System Script - Syntax Error: Expected ')' to Close '(' at Line 7), Got ','
This Is the Script I'm Using. Got It from This Youtube Video: . I've Checked and Tried to Solve This Multiple Times, Can't Find My Mistake. Roblox Studio...
This is the script I'm using. Got It from this YouTube video:
.
I've checked and tried to solve this multiple times, can't find my mistake.
Roblox Studio PrtScrn:
local RP = game:GetService("ReplicatedStorage")
local Combat = RP:WaitForChild("Combat")
local Animations = script:WaitForChild("Animations")
local anims =
(
Animations:WaitForChild("RightPunch"), -- error is here.
Animations:WaitForChild("LeftKnee"),
Animations:WaitForChild("LeftPunch"),
Animations:WaitForChild("RightKnee"),
Animations:WaitForChild("StrongKick"),
)
Combat.OnServerEvent:Connect(function(player,count)
local Character = player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Attack = Humanoid:LoadAnimation(anims[count])
Attack:Play()
Combat:FireClient(player)
end)
1 Answer
Lua tables are created using the table constructor {}.
The error message is caused by local anims = (Animations:WaitForChild("RightPunch"),
because (expr, is invalid syntax. You cannot have a comma separated list inside parentheses ().
Instead of the expected ) Lua will find a , and complain about it.
But you shouldn't use ( in the first place so that error is just a symptom of your actual mistake.
So the thought process here is:
Why does Lua want me to put a ) where I need a , to separate table items ? And why should that ) close ( in line 7? I don't need ( there, this is not how you create a table.