Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make this cutscene play when a part is touched?

Asked by
omorizz 50
2 years ago

i'm using a cutscene plugin by badlydev/beez_up and theres an option to 'play cutscene once when a part is touched' but it just puts the script into replicatedfirst so i'm not sure how to get it to play when a part is touched?

        local data = {{CFrame = CFrame.new(-163.386337, 9.12168503, 86.5627747, -0.190807536, -0.0414887182, 0.980750322, -0, 0.999106526, 0.0422652364, -0.981627524, 0.0080645252, -0.190637022);Seconds = 1.5;Style = Enum.EasingStyle.Sine},{CFrame = CFrame.new(-170.23143, 9.03917599, 87.2517471, -0.0453640521, -0.000388695713, 0.998970389, -0, 0.999999881, 0.000389096298, -0.998970509, 1.76509839e-05, -0.0453640483);Seconds = 1.5;Style = Enum.EasingStyle.Sine}}
        local camera = workspace.CurrentCamera
        local part = game.Workspace:WaitForChild('153211')
        local tween = game:GetService("TweenService")
        local deb = false
        part.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild"Humanoid" then
            if deb == false then
            deb = true
            for i,v in pairs(data) do
            tween:Create(
                camera,
                TweenInfo.new(
                v.Seconds,
                v.Style,
                Enum.EasingDirection.Out,
                0,
                false,
                0
                ),
            {CFrame = v.CFrame}
        ):Play()
        wait(v.Seconds)
        end
            end
            end
        end)
0
What do you mean when it "puts the script into replicatedfirst"? bailley5 114 — 2y

1 answer

Log in to vote
1
Answered by
bailley5 114
2 years ago
Edited 2 years ago

It is FindFirstChild("Humanoid") not FindFirstChild"Humanoid"

local data = {{CFrame = CFrame.new(-163.386337, 9.12168503, 86.5627747, -0.190807536, -0.0414887182, 0.980750322, -0, 0.999106526, 0.0422652364, -0.981627524, 0.0080645252, -0.190637022);Seconds = 1.5;Style = Enum.EasingStyle.Sine},{CFrame = CFrame.new(-170.23143, 9.03917599, 87.2517471, -0.0453640521, -0.000388695713, 0.998970389, -0, 0.999999881, 0.000389096298, -0.998970509, 1.76509839e-05, -0.0453640483);Seconds = 1.5;Style = Enum.EasingStyle.Sine}}
local camera = workspace.CurrentCamera
local part = game.Workspace:WaitForChild('153211')
local tween = game:GetService("TweenService")
local deb = false
part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
    if deb == false then
    deb = true
    for i,v in pairs(data) do
    tween:Create(
        camera,
        TweenInfo.new(
        v.Seconds,
        v.Style,
        Enum.EasingDirection.Out,
        0,
        false,
        0
        ),
    {CFrame = v.CFrame})
tween:Play()
wait(v.Seconds)
end
    end
    end
end)
0
oh, interesting. that fixed it! not sure why the script was like that, thanks! omorizz 50 — 2y
0
In your original script, you didn't play the tween you just did :Play() so I corrected that as well, glad its working fine! bailley5 114 — 2y
Ad

Answer this question