#my cutscene won't activate and idk why

1 messages · Page 1 of 1 (latest)

hoary acorn
#

so basically i have this cutscene of the player walking in to their house and whenever the player interacts with the hitbox it doesnt activate (THIS IS ONLY 1 PART OF IT)

local char = player.Character or player.CharacterAdded:Wait()
local camera = game.Workspace.CurrentCamera
local camfolder = game.Workspace:WaitForChild("Cams2")

local tweenService = game:GetService("TweenService")

-- Get all required parts
local hit = camfolder:FindFirstChild("Hitbox2")
local playerpos = camfolder:FindFirstChild("PlayerPosition2")
local camera1 = camfolder:FindFirstChild("camera1")
local camera2 = camfolder:FindFirstChild("camera2")
local door = workspace:FindFirstChild("Door")

if not (hit and playerpos and camera1 and camera2 and door) then
    warn("Missing one or more required objects in Workspace or Cams2.")
    return
end

local played = false

-- Create camera tween
local camTween = tweenService:Create(camera, TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
    CFrame = camera2.CFrame
})

hit.Touched:Connect(function(otherPart)
    if played then return end

    local character = otherPart:FindFirstAncestorOfClass("Model")
    if character and character:FindFirstChild("Humanoid") and character == player.Character then
        print("Cutscene triggered")
        played = true

        local humanoid = char:FindFirstChildOfClass("Humanoid")
        local root = char:FindFirstChild("HumanoidRootPart")

        -- Freeze movement
        if humanoid then
            humanoid.WalkSpeed = 0
            humanoid.JumpPower = 0
        end

        -- Open the door (make invisible/non-collide)
        door.Transparency = 1
        door.CanCollide = false

        -- Set up cutscene camera
        camera.CameraType = Enum.CameraType.Scriptable
        camera.CFrame = camera1.CFrame

        -- Move player to start of cutscene
        if root then
            root.CFrame = playerpos.CFrame
        end

        ```
severe leafBOT
#

studio** You are now Level 6! **studio

hoary acorn
#

        -- Tween both camera and player into the house
        local movePlayer = tweenService:Create(root, TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
            CFrame = camera2.CFrame
        })

        print("Playing camera + player tween...")
        camTween:Play()
        movePlayer:Play()
        camTween.Completed:Wait()

        -- Close the door
        door.Transparency = 0
        door.CanCollide = true

        task.wait(0.5)

        -- Restore control
        if humanoid then
            humanoid.WalkSpeed = 7.2
            humanoid.JumpPower = 50
        end

        camera.CameraType = Enum.CameraType.Custom
        player.CameraMode = Enum.CameraMode.LockFirstPerson

        print("Cutscene done.")
    end
end)```
#

thats the other part

#

i was using chatgpt to see if i could fix it but doesnt seem like it helped a bunch

#

and just to put it out there i dont know jack shit abt scripting so pls be patient

#

this is the folder of stuff

kindred remnant
#

Your script creates the camTween outside the hit.Touched function but never plays it

#

add camTween:Play

#

camTween:Play()

#

sync the door with the cutscene

#

task.wait(put your number here)

#

The played flag is good but if the player resets and the script runs again. played is reset Consider using setAttribute on hit to store state:

#

hit:SetAttribute("Played", true)

#

this is the fixed script lmk

#

bruh

#

also learn scripting

#

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local camera = game.Workspace.CurrentCamera
local camfolder = game.Workspace:WaitForChild("Cams2")

local tweenService = game:GetService("TweenService")

local hit = camfolder:FindFirstChild("Hitbox2")
local playerpos = camfolder:FindFirstChild("PlayerPosition2")
local camera1 = camfolder:FindFirstChild("camera1")
local camera2 = camfolder:FindFirstChild("camera2")
local door = workspace:FindFirstChild("Door")

if not (hit and playerpos and camera1 and camera2 and door) then
warn("Missing one or more required objects in Workspace or Cams2.")
return
end

local played = hit:GetAttribute("Played") or false

local camTween = tweenService:Create(camera, TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
CFrame = camera2.CFrame
})

hit.Touched:Connect(function(otherPart)
if played then return end

local character = otherPart:FindFirstAncestorOfClass("Model")
if character and character:FindFirstChild("Humanoid") and character == player.Character then
    print("Cutscene triggered")
    played = true
    hit:SetAttribute("Played", true)

    local humanoid = char:FindFirstChildOfClass("Humanoid")
    local root = char:FindFirstChild("HumanoidRootPart")

 
    if humanoid then
        humanoid.WalkSpeed = 0
        humanoid.JumpPower = 0
    end

    
    task.wait(0.5) 
    door.Transparency = 1
    door.CanCollide = false


    camera.CameraType = Enum.CameraType.Scriptable
    camera.CFrame = camera1.CFrame


    if root then
        root.CFrame = playerpos.CFrame
    end

   
    camTween:Play()

controls
camTween.Completed:Wait()
camera.CameraType = Enum.CameraType.Custom

    if humanoid then
        humanoid.WalkSpeed = 16
        humanoid.JumpPower = 50
    end
end

end)

#

im not a god at scripting

#

but this should fix it

hoary acorn
hoary acorn
kindred remnant
#

thats nice

#

if it does not work then go to youtube search how to make cutscenes and listen to the tutorial carefully

#

so next time you know how to make a cutscene

hoary acorn
#

well i know how to make the cutscene i’ve seen the tutorial it just got a little more complicated for me cause i’ve added a couple things to it

#

but either way tysm again

kindred remnant
#

did it work?

hoary acorn
#

let me test rn

kindred remnant
#

if it didnt work then reset the script and write a new one

#

maybe theres a line of code that ruining the script

summer siren
kindred remnant
summer siren
kindred remnant
#

whats the game about

summer siren
#

its not even bad

#

I just need feedback

kindred remnant
#

and why me specifically

summer siren
kindred remnant
#

Thx

hoary acorn
#

doesn’t work

kindred remnant
summer siren
kindred remnant
hoary acorn
#

probably honestly it could be a number of things

summer siren
#

to see if players will like it

kindred remnant
hoary acorn
summer siren
#

its a kid game

kindred remnant
#

end)

hoary acorn
#

alright

kindred remnant
#

change the yourpart with your partt

#

or the hitbox

#

or whatever

hoary acorn
#

kk

summer siren
kindred remnant
#

Yeah just wati bro

#

Wait

summer siren
#

bro wants me to wait without giving me a number

kindred remnant
#

cant you wait bro

summer siren
#

how long

hoary acorn
#

still nothing

kindred remnant
#

did you define the hitbox

hoary acorn
#

i thibk im just gonna rewrite sad rebuild it

hoary acorn
kindred remnant
#

local hitbox = bla bla bla

#

the hitbox doesnt need to be in a folder

#

and maybe the folder is the one that is ruining the code

hoary acorn
#

the hit box is defined yea

kindred remnant
#

Best thing to reWrite it

hoary acorn
#

yeah thank you for helping tho

kindred remnant
#

Np

summer siren