How do you disable freecam?

I’m searching for a thread on how to disable Ctrl + Shift + P a.k.a freecam mode, I wanna disable this forever on my game because I’m tryna play the Piano and It always get’s in the way.

4 Likes

I’m fairly sure that it’s only added to the PlayerGui folder once (upon joining the game), so you could have a LocalScript in StarterPlayerScripts that looks through the PlayerGui folder for it and destroy it if it’s found:

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local PlayerGui = player:WaitForChild("PlayerGui")

if PlayerGui then
    local freecamCheck = PlayerGui:WaitForChild("Freecam") -- Looks for something called "Freecam" inside of the PlayerGui
    if freecamCheck then -- If it finds it...
        freecamCheck:Destroy() -- Then it will be removed from the folder
    end
end
17 Likes

but its still work on a serverscript it’s from my leaderboard script:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player
	
	local Kills = Instance.new("IntValue")
	Kills.Parent = leaderstats
	Kills.Name = "KOs"
	
	local Deaths = Instance.new("IntValue")
	Deaths.Parent = leaderstats
	Deaths.Name = "Wipeouts"
	
	Player.CharacterAdded:Connect(function(Character)
		for _,Child in pairs(Player.PlayerGui:GetChildren()) do
			if Child:IsA("ScreenGui") and Child.Name == "Freecam" then
				Child:Destroy()
			end
		end
		Character.Humanoid.Died:Connect(function()
			local Creator = Character.Humanoid:FindFirstChild("creator")
			if Creator and Creator.Value ~= Player then
				local leaderstats = Creator.Value:FindFirstChild("leaderstats")
				leaderstats.KOs.Value = leaderstats.KOs.Value + 1
			elseif Creator and Creator.Value == Player then
				Kills.Value = Kills.Value - 1
			end
			Deaths.Value = Deaths.Value + 1
		end)
	end)
end)