im making a hide and seek roblox game using luau how can i add this into my game:…
- User
im making a hide and seek roblox game using luau how can i add this into my game: Hider/Seeker Selection Pick 1 player to be Seeker Others become Hiders. Announce roles to each player: “You are a Seeker!” or “You are a Hider!” This is my main game loop script -- Declared Variables local Players = game:GetService("Players") local ServerStorage = game:GetService("ServerStorage")
local IntermissionTime = 5 local RoundTime = 10 local HidingTime = 5 local MinPlayers = 1
local VotingEvent = game.ReplicatedStorage:WaitForChild("Voting") local UpdateVotes = game.ReplicatedStorage:WaitForChild("UpdateVotes") local voteTime = 5
-- Declared Functions local function TeleportPlayers(cframe) -- Teleport all players to a given CFrame local players = Players:GetPlayers() for i, player in players do if not player.Character then continue end
player.Character:PivotTo(cframe) endend
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") TeleportPlayers(workspace.IntermissionArea.SpawnLocation.CFrame * CFrame.new(0, 2, 0)) Countdown(IntermissionTime) end
local function RunGame(map) -- Run the game with a given map print("Game Begins") TeleportPlayers(map.Spawn.CFrame) workspace:SetAttribute("Status", "Time To Hide") Countdown(HidingTime)
workspace:SetAttribute("Status", "Time remaining") Countdown(RoundTime) task.wait(1) map:Destroy() end-- Game Loop while true do if #Players:GetPlayers() >= MinPlayers then Intermission() workspace:SetAttribute("Status", "Loading Map...") print("New Game!")
-- Map voting -- Declared Variables local mapVotes = {} local plrVotes = {} local selectedMaps = {} local currentMaps = game.ServerStorage.Maps:GetChildren() for i = 1, 3 do local newMap = currentMaps[math.random(#currentMaps)] table.remove(currentMaps, table.find(currentMaps, newMap)) 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 = game.ServerStorage.Maps:FindFirstChild(vote) if not mapModel or not mapVotes[mapModel.Name] 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 = 0 for name, votes in pairs(mapVotes) do if votes >= highestVotes then chosenMap = game.ServerStorage.Maps[name] highestVotes = votes end end print(chosenMap, "was picked") task.wait(1) local newMap = chosenMap:Clone() newMap.Parent = workspace -- Map is spawned into workspace -- local maps = ServerStorage.Maps:GetChildren() -- local randomMap = maps[math.random(#maps)] -- Random map is chosen -- local newMap = randomMap:Clone() -- newMap.Parent = workspace -- Chosen Map is moved into workspace -- task.wait(1) RunGame(newMap) -- Players are teleported into the map else print("Waiting for players...") workspace:SetAttribute("Status", "Waiting for players...") task.wait(1) endend this is my local script for game status gui local gui = script.Parent
local function FormatTime(seconds) -- Format seconds as MM:SS local minutes = math.floor(seconds / 60) local remainingSeconds = seconds % 60 return string.format("%02d:%02d", minutes, remainingSeconds) end
local function UpdateStatus() -- Update the GUI with the current status and time local clockTime = workspace:GetAttribute("Clock") local gameStatus = workspace:GetAttribute("Status")
if (gameStatus == "Time remaining" or gameStatus == "Intermission" or gameStatus == "Time To Hide") and clockTime then gui.Display.StatusText.Text = gameStatus .. " : " .. FormatTime(clockTime) else gui.Display.StatusText.Text = gameStatus endend
workspace:GetAttributeChangedSignal("Clock"):Connect(UpdateStatus) workspace:GetAttributeChangedSignal("Status"):Connect(UpdateStatus)
UpdateStatus()
- Assistant
Certainly! Below are the steps and code modifications to add Hider/Seeker role selection to your Roblox hide and seek game using Luau.
Step-by-Step Guide
-
Select the Seeker:
- Randomly pick one player to be the Seeker.
- The remaining players will be Hiders.
-
Announce Roles:
- Send a message to each player informing them of their role.
-
Modify the Main Game Loop Script:
- Add functions to handle role selection and announcement.
- Integrate these functions into the game loop.
-
Modify the Local Script for GUI:
- Update the GUI to display the player's role.
Modified Main Game Loop Script
Here's how you can modify your main game loop script to include Hider/Seeker selection and role announcements.
-- Declared Variables local Players = game:GetService("Players") local ServerStorage = game:GetService("ServerStorage") local ReplicatedStorage = game:GetService("ReplicatedStorage") local IntermissionTime = 5 local RoundTime = 10 local HidingTime = 5 local MinPlayers = 1 local VotingEvent = ReplicatedStorage:WaitForChild("Voting") local UpdateVotes = ReplicatedStorage:WaitForChild("UpdateVotes") local AnnounceRoleEvent = Instance.new("RemoteEvent") AnnounceRoleEvent.Name = "AnnounceRole" AnnounceRoleEvent.Parent = ReplicatedStorage local voteTime = 5 -- Declared Functions local function TeleportPlayers(cframe) -- Teleport all players to a given CFrame local players = Players:GetPlayers() for i, player in ipairs(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") TeleportPlayers(workspace.IntermissionArea.SpawnLocation.CFrame * CFrame.new(0, 2, 0)) Countdown(IntermissionTime) end local function RunGame(map) -- Run the game with a given map print("Game Begins") TeleportPlayers(map.Spawn.CFrame) workspace:SetAttribute("Status", "Time To Hide") Countdown(HidingTime) workspace:SetAttribute("Status", "Time remaining") Countdown(RoundTime) task.wait(1) map:Destroy() end local function SelectRoles() local players = Players:GetPlayers() if #players < 2 then return end -- Not enough players to select roles -- Randomly select the seeker local seeker = players[math.random(1, #players)] -- Announce roles to each player for _, player in ipairs(players) do if player == seeker then AnnounceRoleEvent:FireClient(player,"You are a Seeker!") else AnnounceRoleEvent:FireClient(player,"You are a Hider!") end end end -- Game Loop while true do if #Players:GetPlayers() >= MinPlayers then Intermission() workspace:SetAttribute("Status", "Loading Map...") print("New Game!") -- Map voting -- Declared Variables local mapVotes = {} local plrVotes = {} local selectedMaps = {} local currentMaps = ServerStorage.Maps:GetChildren() for i = 1, 3 do local newMap = currentMaps[math.random(#currentMaps)] table.remove(currentMaps, table.find(currentMaps, newMap)) 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 = ServerStorage.Maps:FindFirstChild(vote) if not mapModel or not mapVotes[mapModel.Name] then warn(tostring(vote).. " is not a votable map") return mapVotes end local playerVote = plrVotes[player.UserId] if playerVote then mapVotes[playerVote] = mapVotes[playerVote] - 1 end plrVotes[player.UserId] = vote mapVotes[vote] = mapVotes[vote] + 1 end return mapVotes end task.wait(voteTime) VotingEvent:FireAllClients(nil) UpdateVotes.OnServerInvoke = nil local chosenMap = nil local highestVotes = 0 for name, votes in pairs(mapVotes) do if votes >= highestVotes then chosenMap = ServerStorage.Maps[name] highestVotes = votes end end print(chosenMap, "was picked") task.wait(1) local newMap = chosenMap:Clone() newMap.Parent = workspace -- Map is spawned into workspace SelectRoles() -- Select and announce roles RunGame(newMap) -- Players are teleported into the map else print("Waiting for players...") workspace:SetAttribute("Status", "Waiting for players...") task.wait(1) end endModified Local Script for Game Status GUI
Update your local script to listen for the role announcement and display it to the player.
local gui = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local AnnounceRoleEvent = ReplicatedStorage:WaitForChild("AnnounceRole") local function FormatTime(seconds) -- Format seconds as MM:SS local minutes = math.floor(seconds / 60) local remainingSeconds = seconds % 60 return string.format("%02d:%02d", minutes, remainingSeconds) end local function UpdateStatus() -- Update the GUI with the current status and time local clockTime = workspace:GetAttribute("Clock") local gameStatus = workspace:GetAttribute("Status") if (gameStatus == "Time remaining" or gameStatus == "Intermission" or gameStatus == "Time To Hide") and clockTime then gui.Display.StatusText.Text = gameStatus .. " : " .. FormatTime(clockTime) else gui.Display.StatusText.Text = gameStatus end end local function AnnounceRole(roleMessage) gui.Display.RoleText.Text = roleMessage -- Assuming you have a RoleText label in your GUI end -- Connect signals workspace:GetAttributeChangedSignal("Clock"):Connect(UpdateStatus) workspace:GetAttributeChangedSignal("Status"):Connect(UpdateStatus) AnnounceRoleEvent.OnClientEvent:Connect(AnnounceRole) -- Initial update UpdateStatus() gui.Display.RoleText.Text = "" -- Clear any previous role textExplanation
-
Role Selection:
- The
SelectRolesfunction randomly selects one player to be the Seeker and announces the roles to each player using theAnnounceRoleEvent.
- The
-
Announcing Roles:
- The
AnnounceRoleEventis aRemoteEventthat sends a message to the client, informing the player of their role. - On the client side the
AnnounceRolefunction updates the GUI to display the player's role
- The
-
Game Loop Integration:
- The
SelectRolesfunction is called after the map is voted on and before the game starts, ensuring roles are assigned at the beginning of each round.
- The
-
GUI Update:
- The local script listens for the
AnnounceRoleEventand updates aRoleTextlabel in the GUI to display the player's role.
- The local script listens for the
-
- User
Visual Feedback: Add particle effects or sounds when roles are assigned (seeker has different particles effects and sounds compared to hiders) Team Colors: Use player.Team to visually distinguish Seekers/Hiders and sort them into teams so you can see them on the leaderboard change text colour red if player is seeker and text colour blue if player is hider
- Assistant
Sure! Below are the modifications to add visual feedback, team colors, and change text color based on the player's role.
Server Script Modifications
-
Add Particle Effects and Sounds:
- Use
RemoteEventsto trigger particle effects and sounds on the client. - Create particle effects and sounds in
ServerStorage.
- Use
-
Team Colours:
- Use the
Teamsservice to create and assign teams. - Use
Player.TeamColorto set the team colour
- Use the
Modified Main 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 = 10 local HidingTime = 5 local MinPlayers = 1 local VotingEvent = ReplicatedStorage:WaitForChild("Voting") local UpdateVotes = ReplicatedStorage:WaitForChild("UpdateVotes") local AnnounceRoleEvent = Instance.new("RemoteEvent") AnnounceRoleEvent.Name = "AnnounceRole" AnnounceRoleEvent.Parent = ReplicatedStorage local voteTime = 5 -- Create Teams local SeekersTeam = Instance.new("Team") SeekersTeam.Name = "Seekers" SeekersTeam.TeamColor = BrickColor.Red() SeekersTeam.Parent = Teams local HidersTeam = Instance.new("Team") HidersTeam.Name = "Hiders" HidersTeam.TeamColor = BrickColor.Blue() HidersTeam.Parent = Teams -- Declared Functions local function TeleportPlayers(cframe) -- Teleport all players to a given CFrame local players = Players:GetPlayers() for i, player in ipairs(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") TeleportPlayers(workspace.IntermissionArea.SpawnLocation.CFrame * CFrame.new(0, 2, 0)) Countdown(IntermissionTime) end local function RunGame(map) -- Run the game with a given map print("Game Begins") TeleportPlayers(map.Spawn.CFrame) workspace:SetAttribute("Status", "Time To Hide") Countdown(HidingTime) workspace:SetAttribute("Status", "Time remaining") Countdown(RoundTime) task.wait(1) map:Destroy() end local function SelectRoles() local players = Players:GetPlayers() if #players < 2 then return end -- Not enough players to select roles -- Randomly select the seeker local seeker = players[math.random(1, #players)] -- Announce roles to each player for _, player in ipairs(players) do if player == seeker then player.Team = SeekersTeam AnnounceRoleEvent:FireClient(player,"You are a Seeker!", "seeker") else player.Team = HidersTeam AnnounceRoleEvent:FireClient(player,"You are a Hider!", "hider") end end end -- Game Loop while true do if #Players:GetPlayers() >= MinPlayers then Intermission() workspace:SetAttribute("Status", "Loading Map...") print("New Game!") -- Map voting -- Declared Variables local mapVotes = {} local plrVotes = {} local selectedMaps = {} local currentMaps = ServerStorage.Maps:GetChildren() for i = 1, 3 do local newMap = currentMaps[math.random(#currentMaps)] table.remove(currentMaps, table.find(currentMaps, newMap)) 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 = ServerStorage.Maps:FindFirstChild(vote) if not mapModel or not mapVotes[mapModel.Name] then warn(tostring(vote).. " is not a votable map") return mapVotes end local playerVote = plrVotes[player.UserId] if playerVote then mapVotes[playerVote] = mapVotes[playerVote] - 1 end plrVotes[player.UserId] = vote mapVotes[vote] = mapVotes[vote] + 1 end return mapVotes end task.wait(voteTime) VotingEvent:FireAllClients(nil) UpdateVotes.OnServerInvoke = nil local chosenMap = nil local highestVotes = 0 for name, votes in pairs(mapVotes) do if votes >= highestVotes then chosenMap = ServerStorage.Maps[name] highestVotes = votes end end print(chosenMap, "was picked") task.wait(1) local newMap = chosenMap:Clone() newMap.Parent = workspace -- Map is spawned into workspace SelectRoles() -- Select and announce roles RunGame(newMap) -- Players are teleported into the map else print("Waiting for players...") workspace:SetAttribute("Status", "Waiting for players...") task.wait(1) end -- Clear teams for next round for _, player in ipairs(Players:GetPlayers()) do player.Team = nil end endModified Local Script for Game Status GUI
local gui = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local AnnounceRoleEvent = ReplicatedStorage:WaitForChild("AnnounceRole") local Player = game:GetService("Players").LocalPlayer local seekerParticles = ReplicatedStorage:WaitForChild("SeekerParticles") local hiderParticles = ReplicatedStorage:WaitForChild("HiderParticles") local seekerSound = ReplicatedStorage:WaitForChild("SeekerSound") local hiderSound = ReplicatedStorage:WaitForChild("HiderSound") local function FormatTime(seconds) -- Format seconds as MM:SS local minutes = math.floor(seconds / 60) local remainingSeconds = seconds % 60 return string.format("%02d:%02d", minutes, remainingSeconds) end local function UpdateStatus() -- Update the GUI with the current status and time local clockTime = workspace:GetAttribute("Clock") local gameStatus = workspace:GetAttribute("Status") if (gameStatus == "Time remaining" or gameStatus == "Intermission" or gameStatus == "Time To Hide") and clockTime then gui.Display.StatusText.Text = gameStatus .. " : " .. FormatTime(clockTime) else gui.Display.StatusText.Text = gameStatus end end local function AnnounceRole(roleMessage, roleType) gui.Display.RoleText.Text = roleMessage -- Assuming you have a RoleText label in your GUI -- Change text colour based on role if roleType == "seeker" then gui.Display.RoleText.TextColor3 = Color3.fromRGB(255, 0, 0) -- Red for Seeker elseif roleType == "hider" then gui.Display.RoleText.TextColor3 = Color3.fromRGB(0, 0, 255) -- Blue for Hider end -- Play particle effects and sounds if Player.Character then local character = Player.Character if roleType == "seeker" then local particles = seekerParticles:Clone() particles.Parent = character particles:Emit(10) -- Adjust the number of particles as needed seekerSound:Clone().Parent = character seekerSound:Play() elseif roleType == "hider" then local particles = hiderParticles:Clone() particles.Parent = character particles:Emit(10) -- Adjust the number of particles as needed hiderSound:Clone().Parent = character hiderSound:Play() end end end -- Connect signals workspace:GetAttributeChangedSignal("Clock"):Connect(UpdateStatus) workspace:GetAttributeChangedSignal("Status"):Connect(UpdateStatus) AnnounceRoleEvent.OnClientEvent:Connect(AnnounceRole) -- Initial update UpdateStatus() gui.Display.RoleText.Text = "" -- Clear any previous role textExplanation
-
Teams:
- Two teams,
SeekersTeamandHidersTeam, are created and assigned colors (red for seekers, blue for hiders). - Players are assigned to these teams based on their roles.
- Two teams,
-
Particle Effects and Sounds:
seekerParticles,hiderParticles,seekerSound, andhiderSoundare stored inReplicatedStorage.- When a role is announced, the corresponding particle effect and sound are cloned and played on the player's character.
-
Text Colour:
- The
AnnounceRolefunction changes the text colour of theRoleTextlabel based on the player's role. - Red for seekers and blue for hiders.
- The
-
Clearing Teams:
- Teams are cleared at the end of each round to prepare for the next round.
-
- User
i want it so that there is not particles or highlight for hiders and hiders can see seeker highlighted and with particles, the seeker can be seen through structures to hiders, but on the seekers screen the seeker is not higlighted and clear the teams when the round is over.
- Assistant
Certainly! Below are the modifications to achieve the desired behavior:
-
Highlight and Particles for Seeker:
- Only the Seeker will have particles and a highlight.
- Hiders can see the Seeker highlighted and with particles.
- The Seeker cannot see their own highlight and particles.
- The Seeker can be seen through structures by Hiders.
-
Clear Teams:
- Teams are cleared at the end of each round.
Modified Main 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 = 10 local HidingTime = 5 local MinPlayers = 1 local VotingEvent = ReplicatedStorage:WaitForChild("Voting") local UpdateVotes = ReplicatedStorage:WaitForChild("UpdateVotes") local AnnounceRoleEvent = Instance.new("RemoteEvent") AnnounceRoleEvent.Name = "AnnounceRole" AnnounceRoleEvent.Parent = ReplicatedStorage local voteTime = 5 -- Create Teams local SeekersTeam = Instance.new("Team") SeekersTeam.Name = "Seekers" SeekersTeam.TeamColor = BrickColor.Red() SeekersTeam.Parent = Teams local HidersTeam = Instance.new("Team") HidersTeam.Name = "Hiders" HidersTeam.TeamColor = BrickColor.Blue() HidersTeam.Parent = Teams -- Declared Functions local function TeleportPlayers(cframe) -- Teleport all players to a given CFrame local players = Players:GetPlayers() for i, player in ipairs(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") TeleportPlayers(workspace.IntermissionArea.SpawnLocation.CFrame * CFrame.new(0, 2, 0)) Countdown(IntermissionTime) end local function RunGame(map) -- Run the game with a given map print("Game Begins") TeleportPlayers(map.Spawn.CFrame) workspace:SetAttribute("Status", "Time To Hide") Countdown(HidingTime) workspace:SetAttribute("Status", "Time remaining") Countdown(RoundTime) task.wait(1) map:Destroy() end local function SelectRoles() local players = Players:GetPlayers() if #players < 2 then return end -- Not enough players to select roles -- Randomly select the seeker local seeker = players[math.random(1, #players)] -- Announce roles to each player for _, player in ipairs(players) do if player == seeker then player.Team = SeekersTeam AnnounceRoleEvent:FireClient(player,"You are a Seeker!", "seeker") else player.Team = HidersTeam AnnounceRoleEvent:FireClient(player,"You are a Hider!", "hider") end end end -- Game Loop while true do if #Players:GetPlayers() >= MinPlayers then Intermission() workspace:SetAttribute("Status", "Loading Map...") print("New Game!") -- Map voting -- Declared Variables local mapVotes = {} local plrVotes = {} local selectedMaps = {} local currentMaps = ServerStorage.Maps:GetChildren() for i = 1, 3 do local newMap = currentMaps[math.random(#currentMaps)] table.remove(currentMaps, table.find(currentMaps, newMap)) 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 = ServerStorage.Maps:FindFirstChild(vote) if not mapModel or not mapVotes[mapModel.Name] then warn(tostring(vote).. " is not a votable map") return mapVotes end local playerVote = plrVotes[player.UserId] if playerVote then mapVotes[playerVote] = mapVotes[playerVote] - 1 end plrVotes[player.UserId] = vote mapVotes[vote] = mapVotes[vote] + 1 end return mapVotes end task.wait(voteTime) VotingEvent:FireAllClients(nil) UpdateVotes.OnServerInvoke = nil local chosenMap = nil local highestVotes = 0 for name, votes in pairs(mapVotes) do if votes >= highestVotes then chosenMap = ServerStorage.Maps[name] highestVotes = votes end end print(chosenMap, "was picked") task.wait(1) local newMap = chosenMap:Clone() newMap.Parent = workspace -- Map is spawned into workspace SelectRoles() -- Select and announce roles RunGame(newMap) -- Players are teleported into the map else print("Waiting for players...") workspace:SetAttribute("Status", "Waiting for players...") task.wait(1) end -- Clear teams for next round for _, player in ipairs(Players:GetPlayers()) do player.Team = nil end endModified Local Script for Game Status GUI
local gui = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local AnnounceRoleEvent = ReplicatedStorage:WaitForChild("AnnounceRole") local Player = game:GetService("Players").LocalPlayer local UserInterfaceService = game:GetService("UserInterfaceService") local seekerParticles = ReplicatedStorage:WaitForChild("SeekerParticles") local seekerHighlight = ReplicatedStorage:WaitForChild("SeekerHighlight") local seekerSound = ReplicatedStorage:WaitForChild("SeekerSound") local function FormatTime(seconds) -- Format seconds as MM:SS local minutes = math.floor(seconds / 60) local remainingSeconds = seconds % 60 return string.format("%02d:%02d", minutes, remainingSeconds) end local function UpdateStatus() -- Update the GUI with the current status and time local clockTime = workspace:GetAttribute("Clock") local gameStatus = workspace:GetAttribute("Status") if (gameStatus == "Time remaining" or gameStatus == "Intermission" or gameStatus == "Time To Hide") and clockTime then gui.Display.StatusText.Text = gameStatus .. " : " .. FormatTime(clockTime) else gui.Display.StatusText.Text = gameStatus end end local function AnnounceRole(roleMessage, roleType) gui.Display.RoleText.Text = roleMessage -- Assuming you have a RoleText label in your GUI -- Change text colour based on role if roleType == "seeker" then gui.Display.RoleText.TextColor3 = Color3.fromRGB(255, 0, 0) -- Red for Seeker elseif roleType == "hider" then gui.Display.RoleText.TextColor3 = Color3.fromRGB(0, 0, 255) -- Blue for Hider end -- Play particle effects and sounds for Seeker if roleType == "seeker" then if Player.Character then local character = Player.Character -- Add particles local particles = seekerParticles:Clone() particles.Parent = character particles:Emit(10) -- Adjust the number of particles as needed -- Add highlight local highlight = seekerHighlight:Clone() highlight.Parent = character highlight.Adornee = character -- Play sound seekerSound:Clone().Parent = character seekerSound:Play() end elseif roleType == "hider" then -- Hiders can see the seeker highlighted and with particles for _, player in ipairs(game:GetService("Players"):GetPlayers()) do if player.Team == game:GetService("Teams"):FindFirstChild("Seekers") and player.Character then local character = player.Character -- Add particles local particles = seekerParticles:Clone() particles.Parent = character particles:Emit(10) -- Adjust the number of particles as needed -- Add highlight local highlight = seekerHighlight:Clone() highlight.Parent = character highlight.Adornee = character end end end end -- Connect signals workspace:GetAttributeChangedSignal("Clock"):Connect(UpdateStatus) workspace:GetAttributeChangedSignal("Status"):Connect(UpdateStatus) AnnounceRoleEvent.OnClientEvent:Connect(AnnounceRole) -- Initial update UpdateStatus() gui.Display.RoleText.Text = "" -- Clear any previous role textExplanation
-
Highlight and Particles for Seeker:
- When a player is assigned the Seeker role, particles, a highlight, and a sound are added to their character.
- Hiders can see the Seeker highlighted and with particles because the script adds these effects to the Seeker's character for all Hiders.
- The Seeker does not see their own highlight and particles because the script only adds these effects for Hiders when the Seeker's role is announced.
-
Seeing Through Structures:
- The
seekerHighlightshould have theFillTransparencyproperty set to1and theOutlineTransparencyproperty set to0to make the Seeker visible through structures.
- The
-
Clearing Teams:
- Teams are cleared at the end of each round to prepare for the next round.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.