Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- local Script
- local Keybind = "E"
- local Cooldown = 1
- local UIS = game:GetService("UserInputService")
- local RS = game:GetService("ReplicatedStorage")
- local Deb = false
- UIS.InputBegan:Connect(function(Input)
- if Input.KeyCode == Enum.KeyCode[Keybind] and not Deb then
- Deb = true
- RS.FireBallEvent:FireServer(game.Players.LocalPlayer:GetMouse().Hit.p)
- wait(Cooldown)
- Deb = false
- end
- end)
- --- Server Script
- local Speed = 100
- local Survive = 1
- local Damage = 12
- local RS = game:GetService("ReplicatedStorage")
- RS.FireBallEvent.OnServerEvent:Connect(function(plr, HitPos)
- if plr and plr.Character and plr.Character.PrimaryPart and plr.Character:FindFirstChild("Humanoid") then
- local Clone = RS.Fireball:Clone()
- Clone.Parent = workspace
- Clone.Position = plr.Character.PrimaryPart.CFrame:PointToWorldSpace(Vector3.new(0,0,-5))
- local BV = Instance.new("BodyVelocity", Clone)
- BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- BV.P = math.huge
- BV.Velocity = CFrame.new(Clone.Position,HitPos).LookVector * Speed
- local Deb = {}
- Clone.Touched:Connect(function(Hit)
- if Hit.Parent:FindFirstChild("Humanoid") then
- if not table.find(Deb, Hit.Parent.Humanoid) and Hit.Parent.Humanoid ~= plr.Character:FindFirstChild("Humanoid") then
- table.insert(Deb, Hit.Parent.Humanoid)
- game.Debris:AddItem(Clone,.2)
- Hit.Parent.Humanoid:TakeDamage(Damage)
- end
- end
- end)
- game.Debris:AddItem(Clone, Survive)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement