Expect ')' To close?

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

image

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…

Have you tried removing the ‘)’ at the end of
speaker:SetExtraData(‘Tags’, {{TagText = ‘Owner’, TagColor = Color3.fromRGB(85, 255, 127)}}) ?

If not, try that

Oh that doesn’t work and I forgot to mention the error appears at the last end)

try 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

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
1 Like

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.

1 Like

This is the full script,

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)

image

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
1 Like
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
1 Like

Try this

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)
1 Like

This works thank you, How come it didn’t work since I got rid of the last end?

try putting another ) on line 5

You have 1 extra end after the print

You had an extra end and also a close bracket, you only put a close bracket after an end if you use a function in your script.

You should use my script, I made a few tweaks for performance.

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)