Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

01local Player = game.Players.LocalPlayer
02local mouse = Player:GetMouse()
03local T = script.Parent
04local handle = T:WaitForChild('Handle')
05local debounce = true
06 
07T.Activated:Connect(function()
08    local H = T.Parent:FindFirstChildWhichIsA("Humanoid")
09    if H and debounce ~= true then
10        debounce = false
11        local position = mouse.Hit.Position
12        T.RemoteEvent:FireServer(position)
13        wait(5)
14        debounce = true
15    end
16end)

2nd script (server script)

01local T = script.Parent
02local handle = script.Parent.Handle
03 
04T.RemoteEvent.OnServerEvent:Connect(function(player, position)
05    local rocket = Instance.new("Part")
06    rocket.Parent = workspace
07    rocket.CFrame = CFrame.new(handle.Position, position)
08    rocket.Size = Vector3.new(1,1,1)
09    rocket.BrickColor = BrickColor.Black()
10    local velocity = Instance.new("BodyVelocity")
11    velocity.Parent = rocket
12    velocity.Velocity = position - handle.Position.Unit*25
13    velocity.MaxForce = Vector3.new('inf','inf','inf')
14    rocket.Touched:Connect(function(hit)
15        if hit ~= handle and not T.Parent:FindFirstChild(hit.Name) then
View all 22 lines...

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

0
are there any errors? Mroczusek 111 — 4y
0
there are no errors in script analysis bruce_matthew 4 — 4y
0
it won't fire the rocket i did what i can but no it didn't work bruce_matthew 4 — 4y
0
it doesn't creat part or explosion bruce_matthew 4 — 4y
View all comments (2 more)
0
answered now bruce_matthew 4 — 4y
0
don't need to answer it anmore its already answered bruce_matthew 4 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question