Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't my camera manipulation script reset when requested?

I have a camera script which I created here.

Once an event is fired from the server, it checks to see whether the server has requested for the manipulation to be enabled, or disabled.

When the server requests for the manipulation to be disabled, the manipulation doesn't reset, and as such the player doesn't gain control of the camera.

Is there anything in the script that may be causing this?

ReplicatedStorage = game:GetService("ReplicatedStorage")
CameraEvent = ReplicatedStorage:WaitForChild("CameraEvent")	
Camera = workspace.CurrentCamera
Players = game:GetService("Players")
Player = Players.LocalPlayer
 
function Event(status)
	if status == "Stop" then
		Camera.CameraSubject = Player.Character.Humanoid
		Camera.CameraType = "Custom"	
	end
	if status == "Use" then
		Camera.CameraSubject = workspace.JudgeBrick
		Camera.CameraType = "Scriptable" 
		game:GetService('RunService').Stepped:Connect(function() -- On 
			Camera.CFrame = workspace.JudgeBrick.CFrame
		end)
	end
end

CameraEvent.OnClientEvent:Connect(Event)

1 comment

0

Just to clarify also - I am firstly requesting for the camera to be manipulated, then for it to be reset. This happens in my server script.

1 answer

✓ Accepted answer

if you want to reset you can also just disable the camerascript, then goto line 09 and 10 Camera.CameraSubject = Player.Character.Humanoid Camera.CameraType = "Custom"

then you can enable it back when clicked, this is my camera script (When I click a gui button I disable this):

local target = workspace.GameParts.Misc.CameraFocus
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 180
local i = 0
 
while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)
	* CFrame.Angles(0, angle, 0)
	* CFrame.new(0, 0, 0)       
    angle = angle + math.rad(1)
    i = i + 1
    if i > 3155692631556926 then break end
	
end

remember disabling a script is the property of a script, here is my logic.

Script runs or stops, script is disabled/enable by another script, the camera properties are changed by that script. If this didn't help then I would suggest adding more information into how your disabling/resetting.

This discussion is preserved as it was. New answers, comments, and votes are closed.