Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- in this script, i made a fireball. this is a local script, it will fireserver a script in the serverscriptservice.
- --–//Services\–
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local UserInputService = game:GetService("UserInputService")
- --– Variables----
- local player = game.Players.LocalPlayer
- local Character = player.Character or player.CharacterAdded:Wait()
- local Remote = ReplicatedStorage.Fire.Fireballevent
- local Mouse = player:GetMouse()
- --–//Settings\–
- local Debounce = true
- local Key = 'Q'
- UserInputService.InputBegan:Connect(function(Input , IsTyping)
- if IsTyping then return end
- local KeyPressed = Input.KeyCode
- if KeyPressed == Enum.KeyCode[Key] and Debounce and CUA4 == true and Character then
- Debounce = false
- Remote:FireServer(Mouse.Hit)
- print "Fireserver"
- wait(.1)
- Debounce = true
- end
- end)
- -- this is the script in serverscriptservice:
- --–//Services\–
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- --– Variables----
- local Remote = ReplicatedStorage.Fire.Fireballevent
- --–//Settings\–
- local Damage = 30
- Remote.OnServerEvent:Connect(function(plr, Mouse)
- local Character = plr.Character or plr.CharacterAdded:Wait()
- local Part = Instance.new("Part")
- Part.Shape = Enum.PartType.Ball
- Part.Anchored = true
- Part.CanCollide = false
- Part.Transparency = 0.5
- Part.Color = Color3.fromRGB(255,0,0)
- Part.Material = Enum.Material.Neon
- Part.Size = Vector3.new(3,3,3)
- Part.Name = "FireBall"
- Part.CFrame = Character.HumanoidRootPart.CFrame *CFrame.new (0,10,0)
- Part.Parent = workspace
- local tweenService = game:GetService("TweenService")
- local tweeningInformation = TweenInfo.new(
- 3,
- Enum.EasingStyle.Linear,
- Enum.EasingDirection.Out,
- 0,
- false,
- 0
- )
- local partProperties = {
- Size = Vector3.new(10,10,10);
- Transparency = math.random(0,1)
- }
- local Tween = tweenService:Create(Part, tweeningInformation, partProperties)
- Tween:Play()
- wait(3)
- Part.Anchored = false
- local BodyVelocity = Instance.new("BodyVelocity")
- BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- BodyVelocity.Velocity = Mouse.lookVector*100
- BodyVelocity.Parent = Part
- local Debounce = true
- Part.Touched:Connect(function(h)
- local tweenService = game:GetService("TweenService")
- local tweeningInformation = TweenInfo.new(
- 1,
- Enum.EasingStyle.Linear,
- Enum.EasingDirection.Out,
- 0,
- false,
- 0
- )
- local partProperties = {
- Size = Vector3.new(50,50,50);
- CFrame = h.Parent.HumanoidRootPart.CFrame;
- CFrame = h.CFrame;
- Transparency = 1
- }
- BodyVelocity:Destroy()
- Part.Anchored = true
- Part.CFrame = h.Parent.HumanoidRootPart.CFrame
- local Tween = tweenService:Create(Part,tweeningInformation,partProperties)
- Tween:Play()
- end)
- end)
- that was the fireball script..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement