So, I want to communicate my Server-Sided script to my Client-Sided script. Simple, remote event.
Somehow, this did not work. I might have a simple error in my script, so please point it out.
Server-Sided Script:
local plrs = game.Players
local rem = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents"):WaitForChild("Golden")
plrs.PlayerAdded:Connect(function(plr)
local leaderstats = plr:WaitForChild("leaderstats")
local char = plr.Character or plr.CharacterAdded:Wait()
local deaths = leaderstats:WaitForChild("DeathAmount")
local head = char:WaitForChild("Head")
local humanoid = char:WaitForChild("Humanoid")
deaths.Changed:Connect(function()
if deaths.Value >= 50 then
plr:LoadCharacter()
char = plr.Character or plr.CharacterAdded:Wait()
local billboardGui = Instance.new("BillboardGui",head)
local textLabel = Instance.new("TextLabel",billboardGui)
textLabel.BackgroundTransparency = 1
billboardGui.Parent = char:FindFirstChild("Head")
billboardGui.StudsOffsetWorldSpace = Vector3.new(0,3,0)
billboardGui.Size = UDim2.new(0,200,0,50)
textLabel.Parent = billboardGui
textLabel.Font = Enum.Font.Legacy
textLabel.TextColor = BrickColor.Yellow()
textLabel.Text = "Golden"
textLabel.Size = UDim2.new(0,200,0,50)
textLabel.TextSize = 19
rem:FireClient(plr.UserId)
end
end)
end)
Client-Sided Script:
local rem = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents"):WaitForChild("Golden")
local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local char = plr.Character or plr.CharacterAdded:Wait()
local head = char.PrimaryPart
local chat = game:GetService("Chat")
rem.OnClientEvent:Connect(function()
local setting = {
UserSpecificSettings = {
[plr.UserId] = {
TextColor3 = Color3.fromRGB(255, 215, 0)
}
}
}
chat:SetBubbleChatSettings(setting)
end)
