#Cutscene Rigs

1 messages · Page 1 of 1 (latest)

full hare
#

My cutscene Rigs are invisible.

#

Here is the script INSIDE of the rig: local ReplicatedStorage = game:GetService("ReplicatedStorage")
local playEvent = ReplicatedStorage:WaitForChild("PlayCutsceneEvent")

-- 1. Setup
local rig = workspace:WaitForChild("NPCs"):WaitForChild("Sidney")
local humanoid = rig:WaitForChild("Humanoid")
local root = rig:WaitForChild("HumanoidRootPart")

-- 2. Animation
local animation = script:WaitForChild("Animation")
local track = humanoid:LoadAnimation(animation)

-- 3. Visibility Helper (FIXED)
local function setVisible(visible)
local transparency = visible and 0 or 1

for _, part in ipairs(rig:GetDescendants()) do
    if part:IsA("BasePart") or part:IsA("Decal") then
        part.Transparency = transparency
        part.LocalTransparencyModifier = 0
    end
end

end

-- 4. Collision Helper
local function setCollision(enabled)
for _, part in ipairs(rig:GetDescendants()) do
if part:IsA("BasePart") then
part.CanCollide = enabled
part.CanTouch = enabled
part.CanQuery = enabled
end
end
end

-- 5. Main Cutscene Function
local function playSequence()
print(rig.Name .. " is appearing for the cutscene")

setCollision(false)

humanoid.AutoRotate = false
root.Anchored = true

local targetPos = root.Position
local targetRotation = CFrame.Angles(0, math.rad(180), 0)
rig:PivotTo(CFrame.new(targetPos) * targetRotation)

track:Play()
track.Stopped:Wait()

setVisible(false)

end

-- 6. Initial state
setVisible(false)
setCollision(false)

task.wait(2)
playSequence()

playEvent.OnServerEvent:Connect(function()
playSequence()
end)

#

And here is the Collision Groups thingy: local PhysicsService = game:GetService("PhysicsService")
local ServerStorage = game:GetService("ServerStorage")

local GROUP = "NPCs"

-- Create group safely
pcall(function()
PhysicsService:RegisterCollisionGroup(GROUP)
end)

-- Rules
PhysicsService:CollisionGroupSetCollidable(GROUP, GROUP, false)
PhysicsService:CollisionGroupSetCollidable(GROUP, "Default", false)

-- Assign function
local function setGroup(model)
for _, obj in ipairs(model:GetDescendants()) do
if obj:IsA("BasePart") then
obj.CollisionGroup = GROUP
end
end
end

-- Apply to existing NPC folder
local folder = workspace:WaitForChild("NPCs")

for _, npc in ipairs(folder:GetChildren()) do
if npc:IsA("Model") then
setGroup(npc)
end
end

-- Apply to future NPCs
folder.ChildAdded:Connect(function(npc)
task.wait(0.1)
if npc:IsA("Model") then
setGroup(npc)
end
end)
-- Force character to be visible
for _, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") then
part.LocalTransparencyModifier = 0
end
end

woven needle
#

Put this in ServerScriptService. local RS = game:GetService("ReplicatedStorage")
local PS = game:GetService("PhysicsService")
local NPCF = workspace:WaitForChild("NPCs")
local evt = RS:WaitForChild("PlayCutsceneEvent")

pcall(function() PS:RegisterCollisionGroup("NPCs") end)
PS:CollisionGroupSetCollidable("NPCs","NPCs",false)
PS:CollisionGroupSetCollidable("NPCs","Default",false)

local function setGroup(m)
for _,p in ipairs(m:GetDescendants()) do
if p:IsA("BasePart") then p.CollisionGroup="NPCs" end
end
end

for _,m in ipairs(NPCF:GetChildren()) do
if m:IsA("Model") then setGroup(m) end
end

local rig = NPCF:WaitForChild("Sidney")
local hum = rig:WaitForChild("Humanoid")
local root = rig:WaitForChild("HumanoidRootPart")
local anim = rig:WaitForChild("CutsceneAnimation")
local track = hum:LoadAnimation(anim)

local function setVisible(v)
local t = v and 0 or 1
for _,p in ipairs(rig:GetDescendants()) do
if p:IsA("BasePart") or p:IsA("Decal") then
p.Transparency=t
p.LocalTransparencyModifier=0
end
end
end

local function setCollide(v)
for _,p in ipairs(rig:GetDescendants()) do
if p:IsA("BasePart") then
p.CanCollide=v
p.CanTouch=v
p.CanQuery=v
end
end
end

local function play()
setVisible(true)
setCollide(false)
hum.AutoRotate=false
root.Anchored=true
rig:PivotTo(CFrame.new(root.Position)*CFrame.Angles(0,math.rad(180),0))
track:Play()
track.Stopped:Wait()
setVisible(false)
end

setVisible(false)
setCollide(false)
task.wait(1)
play()

evt.OnServerEvent:Connect(play)

full hare
#

@woven needle I fixed that but now i have another question