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 )
01 | local Player = game.Players.LocalPlayer |
02 | local mouse = Player:GetMouse() |
03 | local T = script.Parent |
04 | local handle = T:WaitForChild( 'Handle' ) |
07 | T.Activated:Connect( function () |
08 | local H = T.Parent:FindFirstChildWhichIsA( "Humanoid" ) |
09 | if H and debounce ~ = true then |
11 | local position = mouse.Hit.Position |
12 | T.RemoteEvent:FireServer(position) |
2nd script (server script)
01 | local T = script.Parent |
02 | local handle = script.Parent.Handle |
04 | T.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 = Vector 3. 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 = Vector 3. new( 'inf' , 'inf' , 'inf' ) |
14 | rocket.Touched:Connect( function (hit) |
15 | if hit ~ = handle and not T.Parent:FindFirstChild(hit.Name) then |
16 | local exp = Instance.new( "Explosion" ) |
17 | exp.Parent = workspace |
18 | exp.Position = rocket.Position |
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