#Parent property of Camera is locked? Pls assist
325 messages · Page 1 of 1 (latest)
This happens because you are setting the camera object to nil most likely with :Destroy and therefore you are getting that error
But could be different reasons
Okay so we have some movement
I commented out the Destroy blocks and now I get this
So the only issue now is that the Cat icon does not pop up
Which I think is an issue because the previous viewport of the chest is not being destroyed and replaced with the randomly chosen reward from the chest
try asking in gui scripting
since they are gui scripters
dunno
where is gui scripting. the gui chat is just ppls gui art
Basically me when it comes to Lua. I'm not a scripter but I'm tryna learn
whats your issue
So. the first two pics in this chat is the error I get when I don't have the destroy block commented out of the script.
What happens, the player walks over to the chest. Holds "E" to open the chest. the chest pops up, shakes a little then the contents is revealed. In this case it's a 100% chance of it being a cat.
If I have the Destroy code block enabled I get the error. If I comment the destroy block out It goes through and I get this instead of the cat showing up.
No you just have to remove the first for loop, you are checking if v’s class name is a camera then destroy it right after you try to set its parent.
Which I'm pretty sure is because I'm not destroying and resetting the camera parent
This did not work
What do you mean it did not work? You are trying to change a parent of a null object?
I just enabled the second block and tried it Got the same error as I did first time
And that is what the first for loop does
Oh you are checking if it is a camera too in the other for loop
You can keep the for loop just quit checking if it is a camera. Pardon if I say some wrong stuff I am on phone and it is not the best to red code on
where is the cat part
Chosen survivor
maybe youre just deleting the cat with your for loop
He is not because he is not looping through that array
bro
*table
Okay so we have movement again
I get no more errors
yeah
local runService = game:GetService("RunService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local tweenService = game:GetService("TweenService")
local chests = workspace:WaitForChild("MainFolder_Workspace"):WaitForChild("Chests")
local remotes = replicatedStorage:WaitForChild("Remotes")
local survivors = replicatedStorage:WaitForChild("Survivors")
local player = players.LocalPlayer
local chestSystemSS = player:WaitForChild("PlayerGui"):WaitForChild("ChestSystem")
local chestViewport = chestSystemSS:WaitForChild("ChestViewport")
local function openChest(chestName, chosenSurvivor)
for _, v in pairs(player.PlayerGui:GetChildren()) do
if v:IsA("ScreenGui") and v ~= chestSystemSS then
v.Enabled = false
end
end
chestSystemSS.Enabled = true
for _, v in pairs(chestViewport:GetChildren()) do
if v:IsA("BasePart") or v:IsA("Model") then
v:Destroy()
end
end
chestViewport.Size = UDim2.fromScale(0, 0)
local chestMesh = chests:FindFirstChild(chestName):Clone()
chestMesh.Parent = chestViewport
chestMesh.CFrame = CFrame.new(0, 0, 0)
local camera = Instance.new("Camera")
camera.Parent = chestViewport
camera.CFrame = CFrame.new(0, 0, 4)
chestViewport.CurrentCamera = camera
tweenService:Create(chestViewport, TweenInfo.new(0.7), {Size = UDim2.new (0.35, 0,0.45, 0)}):Play()
task.wait(0.7)
for i = 1, 4 do
tweenService:Create(chestViewport, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Rotation = 20}):Play()
task.wait (0.3)
tweenService:Create(chestViewport, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Rotation = -20}):Play()
task.wait (0.3)
end
tweenService:Create(chestViewport, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Rotation = 0}):Play()
task.wait (0.3)
tweenService:Create(chestViewport, TweenInfo.new(0.7), {Size = UDim2.new (0, 0)}):Play()
task.wait (0.3)
for _, v in pairs(chestViewport:GetChildren()) do
if v:IsA("BasePart") or v:IsA("Model") then
v:Destroy()
end
end
local survivorModel = survivors:FindFirstChild(chosenSurvivor.survivorName):Clone()
survivorModel:PivotTo(CFrame.new(0, 0, 0))
survivorModel.Parent = chestViewport
local cameraSurvivor = Instance.new("Camera")
camera.Parent = chestViewport
camera.CFrame = CFrame.new(0, 0, -3.3) * CFrame.Angles(0, math.rad (180), 0)
chestViewport.CurrentCamera = cameraSurvivor
tweenService:Create(chestViewport, TweenInfo.new(0.7), {Size = UDim2.new (0.35, 0,0.45, 0)}):Play()
chestViewport.NameLabel.Text = chosenSurvivor.survivorName
chestViewport.NameLabel.Visible = true
chestViewport.RarityLabel.Text = chosenSurvivor.Rarity
chestViewport.RarityLabel.Visible = true
task.wait (1.5)
tweenService:Create(chestViewport, TweenInfo.new(0.3), {Size = UDim2.new (0, 0)}):Play()
task.wait (0.3)
chestViewport.NameLabel.Visible = false
chestViewport.RarityLabel.Visible = false
for _, v in pairs(player:WaitForChild("PlayerGui"):GetChildren()) do
if v:IsA("ScreenGui") and v ~= chestSystemSS then
v.Enabled = false
end
end
end
remotes:WaitForChild("OpenChest").OnClientEvent:Connect((openChest))
** You are now Level 6! **
Wait so whole problem was that you forgot to add the part that was the missing?
I removed the check for the camera
damn
where
is the fucking camera
position
😭
spagheti codde
fr
its not that much
the
other one
oh yeah
a guy
told me to do it like that way
well
I'm not a scripter
Looks nice though
WHY TF
IS THE
CAMERA
IN THE MIDDLE
U NEED
TO PUT
ALL LOCALS ON TOP
wit lov
bc he creating a new one
its not necesary
why tf
there is no reason
for creating
a camera
for viewport
lemme actually see the code
u need a new camera for viewports
oh
i just saw
no
i just tought
he created a camera for move it
like
move the real camera
viewport =/= workspace
is that still the case
I have not changed anything since removing V:IsA ("Camera") or
Since I removed V:IsA ("Camera") or
It works but the cat is tiny
then put the camera closer
or cat closer to camera
idk where is the camera
Well yea when you want to access something that doesn’t exist shit tends to break
local cameraSurvivor = Instance.new ("Camera") creates a new camera no?
Tryna learn how to use it first 
yeah
Yes but remember how @marble raptor said to keep locals at the top
So right after I create it, I'm setting it's parent to chestViewport
You don’t want your variables defined all over the place even if you are not using them right then
And services before locals
No
he cant do that since hes creating it in the function
local cameraSurvivor = Instance.new("Camera") is not at the top because I create it. Set it's parent, show it then destroy it
Top of function then
i know
Then I do it again but instead of it showing a chest it shows the cat
maybe but that can complicate things
like?
nothing
bom bom
chikibombom
if you have 738392 variables
How you wont have a random ass variable slapped there
that are almost the same thing
in his script hes creating 2 cameras
thats why u arent s3!
There is this guy that wanted to make a admin system so put every command in a different module 💀
you cant say nerd to people if you are one
hmm
Okay
So
i can get s3 but i refuse to be one of them
Can we get back on track of how to fix the issue
okay
Nuh uh khol pulls all
he cute
Kohl
just get the camera closer to the cat
blud is not listening to me
nah get better
then
what is the
cat
shit
omg
i cant
do this anymore
im out helpin this dud
then how tf can you see a tiny cat then
average s0 advice
Thats like -1 advice possibly the worst piece of coding advice I’ve heard definitely not like modules are meant to store stuff
☠️☠️☠️☠️
im telling you for the 3rd time
the problem is that your camera is too far from your cat
guy : asks for help
guy : does not listen
cam.CFrame = cat.CFrame -- The cat position 😺
* CFrame.new(
Vector3.new(0, 10, -10), -- Up and in front of it
cat.Position -- Looking at cat
)
here is a little help
Would this work regardless of what comes up?
The chest is meant to work in the same way an egg would in Petsim
😺
the cat emoji wasnt necessary
cam.CFrame = cat.CFrame -- The cat position 😺
* CFrame.new(
Vector3.new(0, 10, -10), -- Up and in front of it 🆙🔼
cat.Position -- Looking at cat 👀👀😺
)
yes thats so cool
🤯 🤯
The fix was a little easier than expected
and I'm not going to lie
Kinda makes me want to take a selfie using a 12gauge
yes just put the camera closer to the cat
Not even
☠️
local camera = Instance.new("Camera")
camera.Parent = chestViewport
camera.CFrame = CFrame.new(0, 0, 4)
That's the first one
local cameraSurvivor = Instance.new("Camera")
cameraSurvivor.Parent = chestViewport
cameraSurvivor.CFrame = CFrame.new(0, 0, -3.3) * CFrame.Angles(0, math.rad (180), 0)
That's the second one
yes but its better to have this adorable sleeping cat view
local cam = workspace.CurrentCamera
local cat = workspace:WaitForChild("Cat")
local distance = 3 -- 📏📐
cam.CameraType = Enum.CameraType.Scriptable -- 📜📜📜
cam.CFrame = CFrame.new( -- 📦📦📦📦🎯🎯
(cat.CFrame * CFrame.new(0, distance, -distance)).Position, -- 😺😺😺😺😺
cat.Position -- 👀👀😺😺😺😺
)
free to go
wait
i forgot the emojis @keen harbor
I even put the camera check back into the destroy blocks and it works
Now it won't go away

now its better
local cam = workspace.CurrentCamera 🎥
local cat = workspace:WaitForChild("Cat") 😺😺
local distance = 3 🥉
cam.CameraType = Enum.CameraType.Scriptable 📜
cam.CFrame = CFrame.new(
(cat.CFrame * CFrame.new(0, distance, -distance)).Position,
cat.Position😺
)

no since it wont work you need to comment them 🤓
:(
i just type win + .
then type emojis
better than linux
ctrl + maj + u + 1F431
:-P
So the big issue was I tried to set the second instant of camera as the same name from the first
print(b"\u1F431".decode("utf-8")
Which is something a level 2 scripter should have seen 🤓
;compile
ὃ1
(I'm jokin)
fuck
cant see with your spaghetti code
unorganized
";compile
Get yo glasses
;compile
File "/app/output.s", line 1
print(b"\u1F431".decode("utf-8")
^
SyntaxError: '(' was never closed
Should have gone to specsavers
get yo scripting courses
alr time to sleep
I mean if I wanted to clean it up I'd just go through and smash return around code blocks
savage why why dude
wtf bro stop stealing my shit
