Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

i'm trying to make a rocket launcher but my script doesn't work?

i couldn't find the problem because there were no errors in the script analysis my scripts below 1st script ( local script )

local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local T = script.Parent
local handle = T:WaitForChild('Handle')
local debounce = true

T.Activated:Connect(function()
	local H = T.Parent:FindFirstChildWhichIsA("Humanoid")
	if H and debounce ~= true then
		debounce = false
		local position = mouse.Hit.Position
		T.RemoteEvent:FireServer(position)
		wait(5)
		debounce = true
	end
end)

2nd script (server script)

local T = script.Parent
local handle = script.Parent.Handle

T.RemoteEvent.OnServerEvent:Connect(function(player, position)
	local rocket = Instance.new("Part")
	rocket.Parent = workspace
	rocket.CFrame = CFrame.new(handle.Position, position)
	rocket.Size = Vector3.new(1,1,1)
	rocket.BrickColor = BrickColor.Black()
	local velocity = Instance.new("BodyVelocity")
	velocity.Parent = rocket
	velocity.Velocity = position - handle.Position.Unit*25
	velocity.MaxForce = Vector3.new('inf','inf','inf')
	rocket.Touched:Connect(function(hit)
		if hit ~= handle and not T.Parent:FindFirstChild(hit.Name) then
			local exp = Instance.new("Explosion")
			exp.Parent = workspace
			exp.Position = rocket.Position
			rocket:Destroy()
		end
	end)
end)

i don't know which one has the problem so i sent both the first script says that if i press i have to wait how many seconds till i can shoot another rocket the second one is the rocket ( i think ) edit:the problem is that it wont fire the rocket

6 comments

0

are there any errors?

0

there are no errors in script analysis

0

it won't fire the rocket i did what i can but no it didn't work

0

it doesn't creat part or explosion

0

answered now

0

don't need to answer it anmore its already answered

1 answer

✓ Accepted answer

Debounce is set to true while firing it requires it NOT to be true.

This discussion is preserved as it was. New answers, comments, and votes are closed.