Hi. You already know who I am by my user, so no need to explain all of that. I yet again have another issue going on with a game of mine. (geez, so rareeeee. ) My parts keep deleting themselves??? For the server, the parts are being shown. For the client, they are not there! My internet connection is fine too, so Iâm not exactly sure whatâs going on here.
-
What do you want to achieve? Keeping these parts where theyâre supposed to be. IN. THE. WORKSPACE.
-
What is the issue? The parts literally keep deleting themselves! For no reason!
-
What solutions have you tried so far? Iâve tried looking for any hidden scripts such as viruses or scripts I created a while back that might be causing this. Nothing. Just random part deletion!
I have no idea whatâs going on. Is this a Roblox bug? Or am I just being stupid unknowingly??? Please, let me know. Iâm so confused.
-- This code is in a Script with the RunContext set to Client!
local Field = game.Workspace:WaitForChild("Camera Field") -- Waiting for the model needed.
local BattleCam = Field:WaitForChild("Battle Cam") -- Waiting for the camera *inside* the model needed.
local Camera = game.Workspace:WaitForChild("Camera") -- Not sure if this is needed, but it's waiting on the workspace camera itself.
while wait() do -- Constantly checking for the needed models/parts.
if Field ~= nil and Camera ~= nil then -- If these parts exist, then the following code will run.
local Children = Field:GetChildren() -- Getting the models children or parts placed inside of it.
BattleCam = Field["Battle Cam"] -- The "Part" camera needed is turned into a variable to make code lines with the listed Instance easier.
Camera.CameraType = Enum.CameraType.Scriptable -- Making the camera scriptable, instead of free cam.
Camera.CFrame = BattleCam.CFrame -- Setting the players camera to the "Part" Camera's CFrame or Position and Orientation for new scripters.
for i = 1, #Children do -- Getting the "Fields" children as listed earlier.
if Children[i].ClassName == "Part" and Children[i].Name ~= "Battle Cam" then -- If the children/parts inside of the "Fields" model ClassName is "Part" *but* it's name is not "Battle Cam" then the following code will run.
local Grounds = Children[i] -- Turning the children/Parts inside of the "Fields" model into a variable to make it easier to list.
Grounds.Transparency = 0 -- Making it visible to only the client.
Grounds.Section2.Transparency = 0 -- Making it visible to only the client.
end
end
print("Player camera fixed.") -- Letting me know/Client know that this script worked.
break -- Breaking the while wait() do end to prevent infinite repeats.
end
end