how can i make it so that the seeker is inside a transparent blue ice block when they are frozen during hiding time and it breaks after the time is over.
this is my game loop script:
-- Declared Variables
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local IntermissionTime = 5
local RoundTime = 15
local HidingTime = 5
local MinPlayers = 1
local voteTime = 5
-- Remote Events and Functions
local VotingEvent = ReplicatedStorage:WaitForChild("Voting")
local UpdateVotes = ReplicatedStorage:WaitForChild("UpdateVotes")
local SeekersList = ReplicatedStorage:WaitForChild("SeekersList")
local RoleAnnouncement = ReplicatedStorage:WaitForChild("RoleAnnouncement")
local RoundEnded = ReplicatedStorage:WaitForChild("RoundEnded")
-- Declared Functions
local function TeleportPlayers(cframe) -- Teleport all players to a given CFrame
local players = Players:GetPlayers()
for i, player in players do
if player.Character then
player.Character:PivotTo(cframe)
end
end
end
local function Countdown(duration) -- Countdown for a given duration variable
for i = duration, 1, -1 do
workspace:SetAttribute("Clock", i)
task.wait(1)
end
end
local function Intermission()
print("Intermission")
workspace:SetAttribute("Status", "Intermission")
if workspace:FindFirstChild("IntermissionArea") and workspace.IntermissionArea:FindFirstChild("SpawnLocation") then
TeleportPlayers(workspace.IntermissionArea.SpawnLocation.CFrame * CFrame.new(0, 2, 0))
else
warn("Could not find IntermissionArea and/or its SpawnLocation.")
end
Countdown(IntermissionTime)
end
local function RunGame(map) -- Run the game with a given map
print("Game Begins")
if map:FindFirstChild("Spawn") then
TeleportPlayers(map.Spawn.CFrame)
else
warn("Selected map is missing a 'Spawn' location.")
end
code
-- Role assignment
local players = Players:GetPlayers()
if #players < 1 then return end
local seekerIndex = math.random(1, #players)
local seeker = players[seekerIndex]
local roles = {}
local seekers = {}
for _, player in players do
local isSeeker = player == seeker
roles[player] = if isSeeker then "Seeker" else "Hider"
if isSeeker then
table.insert(seekers, player)
player.Team = Teams.Seeker
else
player.Team = Teams.Hider
end
end
-- Freeze the seeker
if seeker and seeker.Character then
local humanoid = seeker.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
-- Freeze player
local originalWalkSpeed = humanoid.WalkSpeed
local originalJumpPower = humanoid.JumpPower
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
task.delay(HidingTime, function()
-- Check if the character and humanoid still exist before unfreezing
if seeker.Character and seeker.Character:FindFirstChildOfClass("Humanoid") then
local currentHumanoid = seeker.Character:FindFirstChildOfClass("Humanoid")
currentHumanoid.WalkSpeed = originalWalkSpeed
currentHumanoid.JumpPower = originalJumpPower
end
end)
end
end
-- Send role info to clients
for player, role in roles do
RoleAnnouncement:FireClient(player, role)
end
-- Send seekers list to all clients
SeekersList:FireAllClients(seekers)
workspace:SetAttribute("Status", "Time To Hide")
Countdown(HidingTime)
workspace:SetAttribute("Status", "Time remaining")
Countdown(RoundTime)
task.wait(1)
map:Destroy()
end
-- Add round end cleanup
local function EndRound()
print("Round Ended")
-- Clear teams
for _, player in Players:GetPlayers() do
player.Team = nil
end
code
-- Notify clients
RoundEnded:FireAllClients()
end
local function SetupTeams()
-- Create Seeker Team (Red)
local seekerTeam = Teams:FindFirstChild("Seeker")
if not seekerTeam then
seekerTeam = Instance.new("Team")
seekerTeam.Name = "Seeker"
seekerTeam.TeamColor = BrickColor.new("Bright red")
seekerTeam.AutoAssignable = false
seekerTeam.Parent = Teams
end
code
-- Create Hider Team (Blue)
local hiderTeam = Teams:FindFirstChild("Hider")
if not hiderTeam then
hiderTeam = Instance.new("Team")
hiderTeam.Name = "Hider"
hiderTeam.TeamColor = BrickColor.new("Bright blue")
hiderTeam.AutoAssignable = false
hiderTeam.Parent = Teams
end
end
-- Game Loop
while true do
if #Players:GetPlayers() >= MinPlayers then
Intermission()
SetupTeams()
workspace:SetAttribute("Status", "Loading Map...")
print("New Game!")
code
-- Map voting
local mapsFolder = ServerStorage:FindFirstChild("Maps")
if not mapsFolder or #mapsFolder:GetChildren() < 3 then
warn("Not enough maps in ServerStorage.Maps to start a vote. Need at least 3. Skipping round.")
task.wait(5)
continue -- Skips the rest of the loop and starts over
end
local mapVotes = {}
local plrVotes = {}
local selectedMaps = {}
local currentMaps = mapsFolder:GetChildren()
for i = 1, 3 do
local randomIndex = math.random(#currentMaps)
local newMap = currentMaps[randomIndex]
table.remove(currentMaps, randomIndex)
table.insert(selectedMaps, {
Name = newMap.Name,
Img = newMap:GetAttribute("MapImg")
})
mapVotes[newMap.Name] = 0
end
VotingEvent:FireAllClients(selectedMaps, voteTime)
UpdateVotes.OnServerInvoke = function(player, vote)
if vote then
local mapModel = mapsFolder:FindFirstChild(vote)
if not mapModel or mapVotes[mapModel.Name] == nil then
warn(tostring(vote).. " is not a votable map")
return mapVotes
end
local playerVote = plrVotes[player.UserId]
if playerVote then
mapVotes[playerVote] -= 1
end
plrVotes[player.UserId] = vote
mapVotes[vote] += 1
end
return mapVotes
end
task.wait(voteTime)
VotingEvent:FireAllClients(nil)
UpdateVotes.OnServerInvoke = nil
local chosenMap = nil
local highestVotes = -1
for name, votes in mapVotes do
if votes > highestVotes then
chosenMap = mapsFolder[name]
highestVotes = votes
end
end
if not chosenMap then
print("No map won the vote. Picking a random map from the selection.")
local randomMapInfo = selectedMaps[math.random(#selectedMaps)]
chosenMap = mapsFolder[randomMapInfo.Name]
end
print(chosenMap.Name, "was picked")
task.wait(1)
local newMap = chosenMap:Clone()
newMap.Parent = workspace
RunGame(newMap)
EndRound()
else
print("Waiting for players...")
workspace:SetAttribute("Status", "Waiting for players...")
task.wait(1)
end
end
Assistant
Below is a drop-in, server-side solution that:
• Wraps the Seeker in a transparent blue “ice-block” as soon as the round starts
• Freezes their Humanoid (WalkSpeed / JumpPower = 0)
• “Shatters” the block with a tween when the hiding time ends, then unfreezes the Seeker
• Cleans everything up if the Seeker dies, respawns, or when the round ends
You only have to touch the server script (no extra LocalScripts or assets are required).
1 ) Extra service & helper function
Add this once, near the top of your script with the other local service variables:
lua
local TweenService = game:GetService("TweenService")
-- freezes a player in an ice block, unfreezes after `duration`
local function FreezeInIce(player : Player, duration : number)
if not (player and player.Character and player.Character:FindFirstChild("HumanoidRootPart")) then
return
end
local char = player.Character
local root = char.HumanoidRootPart
local humanoid = char:FindFirstChildOfClass("Humanoid")
if not humanoid then return end
----------------------------------------------------------------
-- Build the ice-block
----------------------------------------------------------------
local ice = Instance.new("Part")
ice.Name = "IcePrison"
ice.Size = Vector3.new(6,10,6) -- a bit larger than the avatar
ice.CFrame = root.CFrame
ice.Anchored = true
ice.CanCollide = true
ice.Material = Enum.Material.Ice
ice.Color = Color3.fromRGB(135, 206, 255) -- light-blue
ice.Transparency = 0.35
ice.Parent = workspace
----------------------------------------------------------------
-- Freeze the Humanoid
----------------------------------------------------------------
local originalWalk = humanoid.WalkSpeed
local originalJump = humanoid.JumpPower
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
-- if the Seeker dies / respawns we should remove the ice asap
local charConn
charConn = player.CharacterAdded:Connect(function(newChar)
if ice and ice.Parent then ice:Destroy() end
if charConn then charConn:Disconnect() end
end)
----------------------------------------------------------------
-- Schedule unfreeze & break animation
----------------------------------------------------------------
task.delay(duration, function()
-- Humanoid might no longer exist
if humanoid and humanoid.Parent then
humanoid.WalkSpeed = originalWalk
humanoid.JumpPower = originalJump
end
-- “Shatter” animation
if ice and ice.Parent then
local twInfo = TweenInfo.new(.7, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local goal = {Transparency = 1, Size = ice.Size * 1.5}
local tw = TweenService:Create(ice, twInfo, goal)
tw:Play()
tw.Completed:Wait()
ice:Destroy()
end
if charConn then charConn:Disconnect() end
end)
end
2 ) Call the helper inside RunGame()
Replace your current freeze code block in RunGame with one line:
lua
-- Freeze the single seeker for the entire hiding phase
FreezeInIce(seeker, HidingTime)
That’s it—the helper already stops the Seeker from moving and handles all clean-up.
Full context for that section of RunGame:
lua
-- Role assignment (existing code)
...
player.Team = isSeeker and Teams.Seeker or Teams.Hider
...
-- Freeze Seeker in ice
FreezeInIce(seeker, HidingTime)
3 ) Round-end clean-up (optional but safe)
EndRound() already clears teams and fires RoundEnded.
If you want to be 100 % safe, you can add a tiny loop that deletes any
left-over IcePrison parts:
lua
for _, ice in ipairs(workspace:GetChildren()) do
if ice.Name == "IcePrison" then ice:Destroy() end
end
Place it just before or after firing RoundEnded() inside EndRound().
What you get
• During the “Time To Hide” phase the Seeker is encased in a frosty, light-blue block.
• They cannot move or jump.
• Hiders clearly see the frozen Seeker; the Seeker sees only the block around themselves (no highlight).
• When the timer expires the block grows, fades, then vanishes while movement is restored.
• If the Seeker dies, respawns, or the round is aborted, the block is destroyed automatically, preventing orphan parts.
No client-side edits, no extra assets—everything replicates from the server.