Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

attempt to concatenate Instance with string? at line 5

Asked by 4 years ago
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

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago
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

0
Just tell me why since my server script is : Philipceo90 18 — 4y
0
the fireclient thing is : game.ReplicatedStorage.BroadcastWinner:FireAllClients(player,player.Name,player.leaderstats.Rebirths.Value * 1000, script.Parent.Parent.Name) Philipceo90 18 — 4y
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 Natsudragneel2500 80 — 4y
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. nekosiwifi 398 — 4y
0
for some reason the fireallclients doesn do it to every player but only to one player Philipceo90 18 — 4y
Ad

Answer this question