--[[
	Cam Hook
	Allows for clicking and viewing a part
	Phoenix
]]


local Remote = game:GetService("ReplicatedStorage").Game.Events.Game.CameraListener

return function(Environment, ID, Settings)
	script = Environment
	
	local Settings = require(Settings)
	local Players  = {}
	
	script.Parent.MouseClick:Connect(function(Player)
		if Player.Character ~= nil then
			if Player.Character.Humanoid.WalkSpeed > 0 and Player.Character.Humanoid.Health > 0 then
				Players[Player.Name] = Player
				Remote:FireClient(Player, ID, Settings)
			end
		end
	end)
	
	Remote.OnServerEvent:Connect(function(Player, ToID, Command)
		if ToID  == ID then
			if Players[Player.Name] ~= nil then
				if Command == "Finish" then
					Players[Player.Name] = nil
					Player.Character:WaitForChild("HumanoidRootPart").Anchored = false
				elseif Command == "Freeze" then
					Player.Character:WaitForChild("HumanoidRootPart").Anchored = true
				elseif Command == "Resume" then
					Player.Character:WaitForChild("HumanoidRootPart").Anchored = false
				end
			end
		end
	end)
end;
