#i wanna make an vfx in my script

1 messages · Page 1 of 1 (latest)

spare pike
#

i wanna clone 4 vfx into player's humanoid root part (the player that pressed G)

#

lua
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

local CanPlay = true

local Animator: Animator = Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local Animation = script:WaitForChild("Animation")
local animtrack = Animator:LoadAnimation(Animation)

function Cinematic(Char)
local CinematicsFolder = game.ReplicatedStorage["VFX"]

local CurrentCameraCFrame = workspace.CurrentCamera.CFrame

Camera.CameraType = Enum.CameraType.Scriptable

local FrameTime = 0
local Connection

Connection = RunService.RenderStepped:Connect(function(DT)
    local NewDT = DT * 60
    FrameTime += NewDT
    local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
    if NeededFrame then
        Char.Humanoid.AutoRotate = false
        Camera.CFrame = Char.HumanoidRootPart.CFrame * NeededFrame.Value
        if #CinematicsFolder.FOV:GetChildren() > 0 then
            Camera.FieldOfView = CinematicsFolder.FOV:FindFirstChild(tonumber(math.ceil(FrameTime))).Value
        end
    else
        Connection:Disconnect()
        Char.Humanoid.AutoRotate = true
        Camera.CameraType = Enum.CameraType.Custom
        Camera.CFrame = CurrentCameraCFrame
        CanPlay = true
    end
end)

end

animtrack:GetMarkerReachedSignal("subtitles"):Connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.Enabled = true
task.wait(3)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Enabled = false
end)

animtrack:GetMarkerReachedSignal("Vfx"):Connect(function()

end)

UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.G then
Cinematic(Character)
animtrack:Play()
end
end)

spare pike
#

if someone can send the script for it then say how it would be if its over here