I have a script where it waits till a value is true then gives you a chat tag but it doesn’t seem to work?
The error is on line 9
Line 5 is just,
chatService.SpeakerAdded:Connect(function(plr)
repeat wait() until
plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true
if plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true then
speaker:SetExtraData('NameColor', Color3.fromRGB(85, 0, 255))
speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(85, 255, 127)}})
print("Gave the owner a special chat tag and chat color!")
end
end
end)
Help would be appreciated thank you!, I’m not very good with end/) and syntax errors…
repeat wait() until
plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true
if plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true then
speaker:SetExtraData('NameColor', Color3.fromRGB(85, 0, 255))
speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(85, 255, 127)}})
print("Gave the owner a special chat tag and chat color!")
end
end
else
repeat wait() until
plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true
if plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true then
speaker:SetExtraData('NameColor', Color3.fromRGB(85, 0, 255))
speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(85, 255, 127)}})
print("Gave the owner a special chat tag and chat color!")
end
end
end
Oh, remove the ) on the last end, you don’t have a function in the script so you don’t need it. If you get an error on the last end after removing the bracket, just delete the whole end.
local plrs = game.Players
local sss = game.ServerScriptService
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
chatService.SpeakerAdded:Connect(function(plr)
local speaker = chatService:GetSpeaker(plr)
-- COPY FROM THIS
repeat wait() until
plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true
if plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true then
speaker:SetExtraData('NameColor', Color3.fromRGB(85, 0, 255))
speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(85, 255, 127)}})
print("Gave the owner a special chat tag and chat color!")
end
end
end)
local plrs = game.Players
local sss = game.ServerScriptService
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
chatService.SpeakerAdded:Connect(function(plr)
local speaker = chatService:GetSpeaker(plr)
-- COPY FROM THIS
repeat wait() until
plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true
if plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true then
speaker:SetExtraData('NameColor', Color3.fromRGB(85, 0, 255))
speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(85, 255, 127)}})
print("Gave the owner a special chat tag and chat color!")
end
end
local plrs = game.Players
local sss = game.ServerScriptService
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
chatService.SpeakerAdded:Connect(function(plr)
local speaker = chatService:GetSpeaker(plr)
-- COPY FROM THIS
repeat task.wait() until
plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true
if plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true then
speaker:SetExtraData('NameColor', Color3.fromRGB(85, 0, 255))
speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(85, 255, 127)}})
print("Gave the owner a special chat tag and chat color!")
end
end
local plrs = game.Players
local sss = game.ServerScriptService
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
chatService.SpeakerAdded:Connect(function(plr)
local speaker = chatService:GetSpeaker(plr)
-- COPY FROM THIS
repeat wait() until
plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true
if plrs[plr].leaderstats:WaitForChild("ChatValues").Owner.Value == true then
speaker:SetExtraData('NameColor', Color3.fromRGB(85, 0, 255))
speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(85, 255, 127)}})
print("Gave the owner a special chat tag and chat color!")
end
end)
local Game = game
local ServerScriptService = Game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService.ChatServiceRunner.ChatService)
local function OnSpeakerAdded(Player)
local Leaderstats = Player:FindFirstChild("ChatValues")
if not Leaderstats then return end
local ChatValues = Leaderstats:FindFirstChild("ChatValues")
if not ChatValues then return end
local Owner = ChatValues:FindFirstChild("Owner")
if not Owner then return end
if not Owner.Value then return end
local Speaker = ChatService:GetSpeaker(Player)
Speaker:SetExtraData("NameColor", Color3.new(1 / 3, 0, 1))
Speaker:SetExtraData("ChatColor", Color3.new(1, 1, 1))
Speaker:SetExtraData("Tags", {{TagText = "Owner", TagColor = Color3.new(1 / 3, 1, 1 / 2)}})
end
ChatService.SpeakerAdded:Connect(OnSpeakerAdded)