so i’ve got this if statement that runs after a remote event
but it’s, really weird
-- theme is a sound
-- script.Parent is a screengui
changeCamera.OnClientEvent:Connect(function()
renderConnection = rService.RenderStepped:Connect(UpdateCamera)
if not workspace:FindFirstChild("MenuRoom") then
script.Parent.Enabled = true -- will NOT run
theme:Play() -- will NOT run
rStorage.MenuRoom.Parent = workspace -- will run ????
end
end)
Where is theme located? Sounds don’t play if they aren’t in the workspace, a Part or an Attachment.
Try this:
changeCamera.OnClientEvent:Connect(function()
print("OnClientEvent fired")
renderConnection = rService.RenderStepped:Connect(UpdateCamera) -- is rService spelled correctly?
print(workspace:FindFirstChild("MenuRoom").Name -- this may not be the correct format, I'm not great at scripting
if not workspace:FindFirstChild("MenuRoom") then
print(script.Parent.Enabled) -- will tell you if it's true, false, or nil
script.Parent.Enabled = true -- will NOT run
theme:Play() -- will NOT run
rStorage.MenuRoom.Parent = workspace -- will run ????
end
end)
okay i’m not sure whether this is agood idea or not
but this is what i ended up doing:
changeCamera.OnClientEvent:Connect(function()
renderConnection = rService.RenderStepped:Connect(UpdateCamera)
if not workspace:FindFirstChild("MenuRoom") then
rStorage.MenuRoom.Parent = workspace
end
if plr:GetAttribute("Loaded") == true then -- checks for attribute to prevent the theme playing during loading
theme:Play()
gui.Enabled = true
end
end)