Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

attempt to concatenate Instance with string? at line 5

local Event = game.ReplicatedStorage.BroadcastWinner

Event.OnClientEvent:Connect(function(Player, Amount, MapName)
	game.StarterGui:SetCore("ChatMakeSystemMessage",{
		Text = "[SYSTEM] "..Player.." won the obby race on the map "..MapName.." and recieved "..Amount.." Coins!";
		Font = Enum.Font.SourceSansBold;
		Color = Color3.fromRGB(239, 184, 56)
	})
end)

1 answer

✓ Accepted answer
local Event = game.ReplicatedStorage.BroadcastWinner
	 
	Event.OnClientEvent:Connect(function(Player, Amount, MapName)
	    game.StarterGui:SetCore("ChatMakeSystemMessage",{
	        Text = "[SYSTEM] "..Player.Name.." won the obby race on the map "..MapName.." and recieved "..Amount.." Coins!";
	        Font = Enum.Font.SourceSansBold;
	        Color = Color3.fromRGB(239, 184, 56)
	    })
	end)

When you concantenate it does not automatically convert to string you should instead the player's names using Player.Name which is a string and would remove your error

5 comments

0

Just tell me why since my server script is :

0

the fireclient thing is : game.ReplicatedStorage.BroadcastWinner:FireAllClients(player,player.Name,player.leaderstats.Rebirths.Value * 1000, script.Parent.Parent.Name)

0

I think you misunderstand how FireAllClients work you don't need to provide player like in fire FireClient so you could just use ell them it should be game.ReplicatedStorage.BroadcastWinner:FireAllClients(player.Name,player.leaderstats.Rebirths.Value * 1000, script.Parent.Parent.Name) and leave your other code as it was originally

0

:FireAllClients does not require a player instance as its first parameter, as you're firing to ALL clients, not just a single, individual player.

0

for some reason the fireallclients doesn do it to every player but only to one player

This discussion is preserved as it was. New answers, comments, and votes are closed.