Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --//Server Script
- local UIS = game:GetService("UserInputService")
- local mouse = game.Players.LocalPlayer:GetMouse()
- local debounce = false
- --PC
- UIS.InputBegan:Connect(function(key, processed)
- if processed or debounce then return end
- debounce = true
- if key.UserInputType == Enum.UserInputType.Keyboard then
- if key.KeyCode == Enum.KeyCode.Z then
- game.ReplicatedStorage.Events.NegativeVortex:FireServer(mouse.Hit.Position)
- end
- end
- wait(1)
- debounce = false
- end)
- --Mobile
- if UIS.TouchEnabled then
- UIS.TouchTap:Connect(function(position, processed)
- if processed or debounce then return end
- debounce = true
- game.ReplicatedStorage.Events.NegativeVortex:FireServer(mouse.Hit.Position)
- wait(1)
- debounce = false
- end)
- end
- --//Local Script
- game.ReplicatedStorage.Events.NegativeVortex.OnServerEvent:Connect(function(player, mousePos)
- local effects = game.ReplicatedStorage.EffectsVortex
- local vortex = effects.NegativeVortex:Clone()
- local explosion = effects.Explosion:Clone()
- local character = player.Character
- --Fireball
- vortex.Position = character.HumanoidRootPart.Position
- vortex.Parent = workspace
- local velocity = Instance.new("BodyVelocity", vortex)
- velocity.Velocity = CFrame.new(vortex.Position, mousePos).LookVector * 50
- --Explosion
- vortex.Touched:Connect(function(hit)
- if hit:IsDescendantOf(character) or hit:FindFirstChild("ParticleEmitter") then return end
- explosion.Position = vortex.Position
- :Destroy()
- explosion.Parent = workspace
- if hit.Parent:FindFirstChild("Humanoid") then
- hit.Parent:FindFirstChild("Humanoid"):TakeDamage(20)
- end
- wait(1)
- explosion:Destroy()
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement