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.
- Tool.Equipped:Connect(function()
- print "ACTIVATED"
- CUA4 = true
- Tool.Unequipped:Connect(function()
- print "DEACTIVATED"
- CUA4 = false
- --–//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..
- In 2020, i also found out how to make things for mobile/pc only. It might be the first thing you think about when making a game, but i'm built different.
- if game:GetService("UserInputService").TouchEnabled == true then
- script.Parent.Text = "Device detected: MOBILE"
- else
- script.Parent.Text = "Device detected: PC"
- end
- flickering light using math.random.
- while true do
- wait(math.random(.1,1))
- script.Parent.PointLight.Enabled = false
- wait(.1)
- script.Parent.PointLight.Enabled = true
- end
- In this script, i made a cutcene system. I tried to use TweenService and EasyingStyle. At that time i almost always used for i = <number1>,<number2> do, so TweenService was new for me.
- --//Variables
- local TS = game:GetService("TweenService")
- local Camera = game.Workspace.CurrentCamera
- wait(1)
- player = game.Players.LocalPlayer
- button = script.Parent
- local debounce = false
- --//Scripts
- local function CamWithEasyingStyle(StartPart, EndPart, Duration, EasingStyle, EasingDirection)
- Camera.CameraType = Enum.CameraType.Scriptable
- Camera.CFrame = StartPart.CFrame
- local Cutscene = TS:Create(Camera, TweenInfo.new(Duration, EasingStyle, EasingDirection), {CFrame = EndPart.CFrame})
- Cutscene:Play()
- wait(1)
- end
- local function CamWithoutEasyingStyle (StartPart, EndPart, Duration)
- Camera.CameraType = Enum.CameraType.Scriptable
- Camera.CFrame = StartPart.CFrame
- local Cutscene = TS:Create(Camera, TweenInfo.new(Duration), {CFrame = EndPart.CFrame})
- Cutscene:Play()
- wait(1)
- end
- local function Cutscene()
- CamWithoutEasyingStyle(game.Workspace.CamA, game.Workspace.CamB, 1)
- wait ()
- CamWithoutEasyingStyle(game.Workspace.CamB, game.Workspace.CamC, 1)
- wait ()
- CamWithoutEasyingStyle(game.Workspace.CamC, game.Workspace.CamD, 1)
- wait() --0.1
- CamWithoutEasyingStyle(game.Workspace.CamD, game.Workspace.CamE, 1)
- wait()
- CamWithoutEasyingStyle(game.Workspace.CamE, game.Workspace.CamF, 1)
- wait()
- CamWithoutEasyingStyle(game.Workspace.CamF, game.Workspace.CamG, 1)
- game.ReplicatedStorage.RemoteEvent:FireServer(player)
- print "fireserver"
- wait()
- CamWithoutEasyingStyle(game.Workspace.CamG, game.Workspace.CamH, .3)
- script.Parent.Parent.TextLabel.Visible = true
- for i = 1,20 do
- wait(.1)
- script.Parent.Parent.TextLabel.BackgroundTransparency = script.Parent.Parent.TextLabel.BackgroundTransparency - .05
- end
- wait(1)
- Camera.CameraType = Enum.CameraType.Custom
- Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
- for i = 1,20 do
- wait(.1)
- script.Parent.Parent.TextLabel.BackgroundTransparency = script.Parent.Parent.TextLabel.BackgroundTransparency + .05
- end
- wait(1)
- script.Parent.Parent.TextLabel.Visible = false
- end
- local Enabled = false
- script.Parent.MouseButton1Click:Connect(function()
- wait(2)
- game.ReplicatedStorage.RemoteEvent2:FireServer(player)
- if Enabled == true then return end Enabled = true
- Cutscene()
- Enabled = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement