#Expected 'end' (to close 'function' at line 14), got <eof>; did you forget to close 'then' at line 3

7 messages · Page 1 of 1 (latest)

thin tundra
#

Got this line in my script and idk hjow to fix it

local RemoteFunction = ReplicatedStorage:WaitForChild("RemoteFunction")
local Bullet = ReplicatedStorage:WaitForChild("Bullet")

local tool = script.Parent

local bulletSpeed = 200
local bulletDamage = 15
local fireRate = 0.1
local canDamage = false


local shooting = false
tool.Activated:Connect(function()
    if shooting == false then
        shooting = true
        
        local player = game.Players:GetPlayerFromCharacter(tool.Parent)
        local MouseHitLookVector = RemoteFunction:InvokeClient(player)
        
        local newBullet = Bullet:Clone()
        newBullet.CFrame = tool.Handle.CFrame
        newBullet.Parent = game.Workspace
        
        newBullet.Velocity = MouseHitLookVector * bulletSpeed
        
        local BulletTouch
        BulletTouch = newBullet.Touched:Connect(function(hit)
            newBullet.velocity = 0
            if hit.Parent then
                local hitHumanoid = newBullet.Parent:FindFirstChild("Humanoid")
                if not hitHumanoid then
                    return
                end
                
                if hitHumanoid then
                    hitHumanoid:TakeDamage(bulletDamage)
                    newBullet.Transparency = 1
                end

        BulletTouch:Disconnect()
        
        wait(fireRate)
        shooting = false
    end
end)
print("Working")```
#

the error is at working and its saying about the if shooting == false then part

#

so idk how to fix it

#

if i add another end

#

it makes another error

shrewd vine
#

Add end)

thin tundra
#

ye i found it ty 🙂