Need help with error

I was making a ability and I got a error
(58,1) Expected ‘)’ to close ‘(’ at line 46), go end

script.Parent.RemoteEvent.OnServerEvent:Connect(function(caller, KeyCode) -------line 46
	if KeyCode == Enum.KeyCode.Q then
		print("dsa")
		if db then
			db = false
			Hitbox:HitStart(2)
	        Spin:Play()
			end
	     end
	     wait(T)
  	     db = true
     end
end) ---------------- line 51

local script (if needed)

local RaycastHitbox = require(game.ReplicatedStorage.RaycastHitboxV4)
local Hitbox = RaycastHitbox.new(script.Parent.Handle)
local uis = game:GetService("UserInputService")
local db = true

uis.InputBegan:Connect(function(input, gameProcessedEvent)
	if gameProcessedEvent == false then
		script.Parent.RemoteEvent:FireServer(input.KeyCode)
	end
end)

db is debounce its needed so that the ability can be used again

I don’t think you understand. Unless my eyes are tricking me.

if db then
	db = false
	Hitbox:HitStart(2)
	Spin:Play()
        end -- Extra end
end

There is four ends in total and there should only be three by looking at your code.

2 Likes

I think it’s better to set db back to true inside the if db then

script.Parent.RemoteEvent.OnServerEvent:Connect(function(caller, KeyCode) -------line 46
	if KeyCode == Enum.KeyCode.Q then
		print("dsa")
		if db then
			db = false
			Hitbox:HitStart(2)
	        Spin:Play()
            task.wait(T)
  	        db = true
	     end
     end
end) 
3 Likes
script.Parent.RemoteEvent.OnServerEvent:Connect(function(caller, KeyCode)
	if KeyCode == Enum.KeyCode.Q then
		print("dsa")
		if db then
			db = false
			Hitbox:HitStart(2)
			Spin:Play()
			wait(3)
			db = true
			end
	     end
     end
end)

like this? i am still getting error

You have an extra end in the script, try this -

script.Parent.RemoteEvent.OnServerEvent:Connect(function(caller, KeyCode)
	if KeyCode == Enum.KeyCode.Q then
		print("dsa")
		if db then
			db = false
			Hitbox:HitStart(2)
			Spin:Play()
			task.wait(3)
			db = true
	     end
     end
end)
1 Like