I am trying to make it to where, when you touch a part it will fire a RemoteEvent. This RemoteEvent is supposed to chat to all players announcing somebody won. It must grab the players name so the server knows who won. 2 scripts make sure this part was touched. The first one changes GUI which works, although the second is supposed to chat to all clients. This one doesn't work. The script within Workspace: (Script fires the event)
local Players = game:GetService("Players")
local events = game.ReplicatedStorage.Events -- Define Events
local EndZone = game.Workspace.zones.TheEnd
local function FireEndEvent(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
events.Completed:FireAllClients(plr)
end
end
EndZone.Touched:connect(FireEndEvent)
The script within StarterGUI: (Script chats to all clients)
local Players = game:GetService("Players")
local events = game.ReplicatedStorage.Events
local StarterGui = game.StarterGui
events.Completed.OnClientEvent:Connect(function(plr)
StarterGui:SetCore("ChatMakeSystemMessage", {
Text = plr.Name.. " completed the game. GG!";
Color = Color3.fromRGB(132, 132, 132);
Font = Enum.Font.SourceSansBold;
FontSize = Enum.FontSize.Size32;
})
end)
