i have a local script in starter player scripts but im being told the my camera part cant be found for my unboxing system as it says its not in worksapce when it is its also named correctly too
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
local openEvent = ReplicatedStorage:WaitForChild("StartUnboxEvent")
local function showRewardGui(text)
local gui = Instance.new("ScreenGui")
gui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")
local label = Instance.new("TextLabel", gui)
label.Size = UDim2.new(0.5, 0, 0.2, 0)
label.Position = UDim2.new(0.25, 0, 0.4, 0)
label.Text = text
label.TextScaled = true
label.BackgroundTransparency = 0.2
label.BackgroundColor3 = Color3.new(0, 0, 0)
label.TextColor3 = Color3.new(1, 1, 1)
wait(3)
gui:Destroy()
end
openEvent.OnClientEvent:Connect(function()
local player = Players.LocalPlayer
local unboxRoom = workspace:WaitForChild("UnboxRoom", 5)
if not unboxRoom then
warn("UnboxRoom not found")
return
end
-- Wait for CameraPart inside UnboxRoom or workspace
local camPart = unboxRoom:FindFirstChild("CameraPart") or workspace:FindFirstChild("CameraPart")
if not camPart then
warn("CameraPart not found in UnboxRoom or workspace")
return
end
local chest = unboxRoom:WaitForChild("ChestModel", 5)
if not chest then
warn("ChestModel not found")
return
end
local lid = chest:WaitForChild("Lid", 5)
if not lid then
warn("Lid not found")
return
end