I'm quite inexperienced at coding, but I wanted to try modifying some existing gun scripts. I tried to keybind the guns to Q, another method I tried resulted in the guns dropping out of the aim stance any time I pressed any other button.
The original script was like this:
mouse.Button2Down:connect(function()
if not meleeing and not reloading then
aim:Play()
aiming = true
tool.GripForward = Vector3.new(-0.1, 0, -0.9)
tool.GripRight = Vector3.new(0.9, 0, -0.1)
mouse.Button2Up:connect(function()
aiming = false
aim:Stop()
tool.GripForward = Vector3.new(0, 0, -1)
tool.GripRight = Vector3.new(1, 0, 0)
end)
end
end)
The first thing I tried was this:
`mouse.KeyDown:connect(function(key)
if key == "q" and not meleeing and not reloading then
aim:Play()
aiming = true
tool.GripForward = Vector3.new(-0.1, 0, -0.9)
tool.GripRight = Vector3.new(0.9, 0, -0.1)
mouse.KeyDown:connect(function()
aiming = false
aim:Stop()
tool.GripForward = Vector3.new(0, 0, -1)
tool.GripRight = Vector3.new(1, 0, 0)
end)
end
end)
and here's what I did most recently :
`mouse.KeyDown:connect(function(key)
if key == "q" and not meleeing and not reloading then
aim:Play()
aiming = true
tool.GripForward = Vector3.new(-0.1, 0, -0.9)
tool.GripRight = Vector3.new(0.9, 0, -0.1)
mouse.KeyDown:connect(function()
if key == "q" and aiming then
aiming = false
aim:Stop()
tool.GripForward = Vector3.new(0, 0, -1)
tool.GripRight = Vector3.new(1, 0, 0)
end)
end
end)
`
But I got an error that said: Expected identifier, got ')' when I tried the most recent method how do I correct this error?

1 comment
Your umm use is a bit messed up with the uhh code blocks and stuff, mind fixing that?