how do you make a highlight for the tagger in bomb tag? and make it change when your tagged?
im not sure how to do this, and im not sure where to add it. help?
001 | local dss = game:GetService( "DataStoreService" ) |
002 | local ds = dss:GetDataStore( "DATA STORES" ) |
003 | local taggerh = game.ReplicatedStorage.BombTagReplicatedStorage.Highlights.TaggerH |
005 | function saveData(plr) |
007 | if not plr:FindFirstChild( "FAILED TO LOAD DATA" ) then |
008 | local cash = plr.leaderstats.Cash.Value |
010 | local success, err = nil , nil |
012 | success, err = pcall ( function () |
013 | return ds:SetAsync(plr.UserId, cash) |
021 | game.Players.PlayerRemoving:Connect(saveData) |
022 | game:BindToClose( function () |
023 | for i, plr in pairs (game.Players:GetPlayers()) do |
029 | game.Players.PlayerAdded:Connect( function (plr) |
031 | local ls = Instance.new( "Folder" ) |
032 | ls.Name = "leaderstats" |
035 | local cashValue = Instance.new( "IntValue" ) |
036 | cashValue.Name = "Cash" |
037 | cashValue.Parent = ls |
040 | local success, data = pcall ( function () |
041 | return ds:GetAsync(plr.UserId) |
045 | cashValue.Value = data or 0 |
048 | local failedValue = Instance.new( "StringValue" ) |
049 | failedValue.Name = "FAILED TO LOAD DATA" |
051 | failedValue.Parent = plr |
057 | local rs = game.ReplicatedStorage:WaitForChild( "BombTagReplicatedStorage" ) |
058 | local config = require(rs:WaitForChild( "CONFIGURATION" )) |
059 | local maps = rs:WaitForChild( "Maps" ) |
062 | local status = Instance.new( "StringValue" ) |
063 | status.Name = "STATUS" |
066 | local currentTagged = Instance.new( "ObjectValue" ) |
067 | currentTagged.Name = "CURRENT TAGGED PLAYER" |
068 | currentTagged.Parent = rs |
070 | local explodeTimer = Instance.new( "IntValue" ) |
071 | explodeTimer.Name = "EXPLODE TIMER" |
072 | explodeTimer.Parent = rs |
075 | function getPlayers(playerList) |
077 | local playerList = playerList or game.Players:GetPlayers() |
078 | local playersInGame = { } |
080 | for i, plr in pairs (playerList) do |
081 | local char = plr.Parent = = game.Players and plr.Character or plr |
082 | if char and char:FindFirstChild( "Humanoid" ) and char.Humanoid.Health > 0 then |
083 | table.insert(playersInGame, char) |
092 | local playersInGame = { } |
094 | while #playersInGame < config.MinimumPlayersNeeded do |
095 | playersInGame = getPlayers() |
097 | if #playersInGame < config.MinimumPlayersNeeded then |
098 | local neededPlayers = config.MinimumPlayersNeeded - #playersInGame |
100 | status.Value = "Waiting for " .. neededPlayers .. " more player" .. (neededPlayers ~ = 1 and "s" or "" ) |
106 | for i = config.IntermissionTime, 0 , - 1 do |
107 | status.Value = "Choosing map in " .. i .. " seconds" |
111 | local chosenMap = maps:GetChildren() [ Random.new():NextInteger( 1 , #maps:GetChildren()) ] :Clone() |
112 | chosenMap.Parent = workspace |
114 | status.Value = "Now entering " .. chosenMap.Name |
116 | task.wait(config.MapWaitTime) |
119 | playersInGame = getPlayers() |
121 | if #playersInGame < config.MinimumPlayersNeeded then |
125 | local tagDebounce = false |
126 | for i, char in pairs (playersInGame) do |
128 | char.Humanoid.WalkSpeed = config.SurvivorSpeed |
129 | char.HumanoidRootPart.CFrame = chosenMap.SPAWN.CFrame |
131 | char.Humanoid.Touched:Connect( function (hit) |
132 | if not tagDebounce and currentTagged.Value then |
134 | local hitChar = hit.Parent |
135 | if game.Players:GetPlayerFromCharacter(hitChar) then |
137 | if char = = currentTagged.Value then |
140 | char.Humanoid.WalkSpeed = config.SurvivorSpeed |
141 | hitChar.Humanoid.WalkSpeed = config.TaggedSpeed |
143 | currentTagged.Value = hitChar |
145 | task.wait(config.TagCooldown) |
148 | elseif hitChar = = currentTagged.Value then |
151 | hitChar.Humanoid.WalkSpeed = config.SurvivorSpeed |
152 | char.Humanoid.WalkSpeed = config.TaggedSpeed |
154 | currentTagged.Value = char |
156 | task.wait(config.TagCooldown) |
168 | playersInGame = getPlayers(playersInGame) |
170 | if #playersInGame > 1 then |
171 | local randomChar = playersInGame [ Random.new():NextInteger( 1 , #playersInGame) ] |
172 | randomChar.Humanoid.WalkSpeed = config.TaggedSpeed |
174 | if iterations = = 1 then |
175 | randomChar.HumanoidRootPart.Anchored = true |
179 | for i = config.PreparationTime, 0 , - 1 do |
180 | status.Value = randomChar.Name .. " is tagged. You have " .. i .. "s to run." |
183 | currentTagged.Value = randomChar |
184 | status.Value = randomChar.Name .. " is tagged" |
185 | randomChar.HumanoidRootPart.Anchored = false |
188 | currentTagged.Value = randomChar |
189 | status.Value = randomChar.Name .. " is tagged" |
192 | local explodesIn = config.BombExplodeTimes [ #playersInGame ] |
193 | explodeTimer.Value = explodesIn |
195 | local bombTimerStarted = tick() |
196 | while tick() - bombTimerStarted < explodesIn do |
198 | game:GetService( "RunService" ).Heartbeat:Wait() |
199 | explodeTimer.Value = explodesIn - math.round(tick() - bombTimerStarted) |
201 | if not currentTagged.Value or #getPlayers(playersInGame) < 2 then |
206 | if currentTagged.Value and #getPlayers(playersInGame) > = 2 then |
207 | local explosion = Instance.new( "Explosion" ) |
208 | explosion.DestroyJointRadiusPercent = 0 |
209 | explosion.Position = currentTagged.Value.HumanoidRootPart.Position |
210 | explosion.Parent = workspace |
212 | currentTagged.Value.Humanoid.Health = 0 |
213 | currentTagged.Value = nil |
220 | local winner = game.Players:GetPlayerFromCharacter(playersInGame [ 1 ] ) |
222 | winner.leaderstats.Cash.Value + = config.SurviveReward |
223 | status.Value = winner.Name .. " wins!" |
227 | for i, plr in pairs (game.Players:GetPlayers()) do |
231 | task.wait(config.RoundEndTime) |