I'm trying to make a time freeze script on roblox. However it doesn't exactly work the way I want it too.
I don't get an error or anything the keys just don't work :/
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local FreezeAll = true -- Freeze all? local admin = "Player1"
function anchorPartsSpecific(model) for i, v in pairs(model:GetChildren()) do if v:IsA"Model" and FreezeAll == false and v.Name == "FreezeMe!" then anchorPartsSpecific(v) elseif v:IsA"BasePart" then v.Anchored = true end end end
function anchorAll(model) for i, v in pairs(model:GetChildren()) do if v:IsA"Model" and FreezeAll == true then anchorAll(v) elseif v:IsA"BasePart" then v.Anchored = true elseif v.Name == admin then print("player found") end end end
function unanchorParts(model) for i, v in pairs(model:GetChildren()) do if v:IsA"Model" then unanchorParts(v) elseif v:IsA"BasePart" then v.Anchored = false end end end
Mouse.KeyDown:connect(function(key) if key:byte() == 29 then elseif FreezeAll == true then anchorAll(workspace) elseif FreezeAll == false then anchorPartsSpecific(workspace) elseif key:byte() == 30 then unanchorParts(workspace) end end)

2 comments
What keys are you wanting to respond to?
Also, please describe what you expect to happen and what is actually happening. This will help others help you.