Summarizd: Working on a game makes firearms firearms work later they don't rewrite code works, but doesn't kill rewrites partial doesn't fire

worked originally with remote event, then stopped, took out, worked, but caused no damage to be dealt, added back in, don't work anymore. Is there something I am missing here? code: (server side)

	local tool = script.Parent

	local canFire = true

	local gunWeld

	local Rocket = game.Lighting.lazer

	local event = Instance.new("RemoteEvent")

	event.Parent= script.Parent

	event.Name = "FIRE_"..tool.Parent.Name

	event = script.Parent:FindFirstChild("FIRE_"..tool.Parent.Name)

	 

	event.OnServerEvent:connect(function(player, targetx)

	    if canFire and player.Character == tool.Parent then

	        canFire = false

	        local rocketClone = Rocket:Clone()

	        local lazee = script.laz:Clone()

	        local oth = script.destr:Clone()

	        local target = targetx.Hit.p

	        local spawnPosition = (tool.Handle.CFrame * CFrame.new(0, 0,0)).p

	        rocketClone.CFrame = CFrame.new(spawnPosition, target)

	        rocketClone.Velocity = rocketClone.CFrame.lookVector * 1000

	        lazee.Parent = rocketClone 

	        oth.Parent = rocketClone   

	        local bod = Instance.new("BodyForce")

	        bod.force = Vector3.new(0,196.2,0) * rocketClone:getMass()

	        bod.Parent = rocketClone

	        rocketClone.Parent = game.Workspace

	        oth.Disabled = false   

	        lazee.Disabled = false

	        delay(0.5, function()

	            canFire = true

	        end)

	    end

	end)

(client side)

local playerx = game.Players.LocalPlayer

	local mouse = playerx:GetMouse()

	local tool = script.Parent

	local waiT = true

	while waiT == true do

	    if tool:FindFirstChild("FIRE_"..playerx.Name) == nil then

	        wait()

	    else

	        waiT = false

	        wait()

	    end

	end

	event = tool:FindFirstChild("FIRE_"..playerx.Name)

	mouse.Button1Down:connect(function()

	    event:FireServer(playerx, mouse)

	end)

2 comments

0

Normally, I wouldn't read a 90 line code, but the errors are a bit obvious to me. In the 1st script, you have to many end(s). Remove the first 2, and above the last, put end.

0

nope, there is the right amount.