Modlons
(Modded)
June 2, 2024, 3:07pm
#1
I am writing a function which updates a button for the player on there death
The only time the remote fires is when the player joins, after that, everything else in the script works except the firing of the remote.
local Players = game.Players
local PlayerButtonStatusUpdate = game.ReplicatedStorage.PlayerButtonStatusRemote
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
PlayerButtonStatusUpdate:FireClient(player, "")
end)
end)
3 Likes
RPD777
(RPD777)
June 2, 2024, 3:59pm
#2
Where is the location of your local script on the client? Do you mind sharing a screenshot?
1 Like
Try Humanoid.Died instead of Player.CharacterAdded
So if players spawn/re-spawn
it fire from a local script?
to a script that print
Modlons
(Modded)
June 2, 2024, 4:57pm
#6
No, it runs from the server script located in the photo. From there is where its supposed to fire to the clients and where it prints.
Can you show us your client-side code?
If I create the following in StarterPlayerScripts
local PlayerButtonStatusUpdate = game.ReplicatedStorage.PlayerButtonStatusRemote
PlayerButtonStatusUpdate.OnClientEvent:Connect(function(message)
print("Message received")
end)
I get Message received
when the player respawns
Modlons
(Modded)
June 2, 2024, 5:13pm
#8
PlayerButtonStatusRemote.OnClientEvent:Connect(function(text)
print("recived text")
QueButton.Text = text
end)
Where is this script located?
Is it in StarterPlayerScripts
?
Modlons
(Modded)
June 2, 2024, 5:50pm
#10
Starter gui, its the one called PlayerQue
Amritss
(EmperorOfChickens)
June 2, 2024, 5:52pm
#11
maybe try adding a little wait if that helps, other than that idk.
try this
local Players = game.Players
local PlayerButtonStatusUpdate = game.ReplicatedStorage.PlayerButtonStatusRemote
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
PlayerButtonStatusUpdate:FireClient(game.Players:GetPlayerFromCharacter(char), "")
end)
end)
its probably the same thing but its worth a shot
Instead what i found easier since the gui’s are funky when recieved by the client you could just set it on the server sometimes it may not be reliable beacuse of the Clients Internet
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FireRemote = ReplicatedStorage.__RemoteName
local Message = "Died :("
game.Players.PlayerAdded:Connect(function(player)
local Character = player.Character or player.CharacterAdded:Wait()
Character.Humanoid.Died:Connect(function()
player.PlayerGui.ScreenGui.TextLabel.Text = Message
end)
end)
My mistake realised it broke afte dieing once simple fix
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FireRemote = ReplicatedStorage.__RemotePath
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
player.Character.Humanoid.Died:Connect(function()
player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui").TextLabel.Text = MessageList[math.random(1,#MessageList)]
end)
end)
end)
XSiggeManx
(GreenGuyGaming)
June 3, 2024, 10:00pm
#15
Assuming that your ScreenGui has its property ResetOnSpawn set to true(which it will by default), the code will rerun every time the player respawns. There is no need for binding any events or using remote events.
system
(system)
Closed
June 17, 2024, 10:00pm
#16
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.