HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 7:33am
1
I made a shooting game, Where a GUI shows the number of bullets and reloads rounds left, But, when the player dies, the ScreenGUI containing the TextLabel doesn’t change its Texts
The script and the ScreenGUI is in the StartGUI folder
Any help would be appreciated
Thanks in Advance!
jellolemo
(jellolemo)
February 28, 2025, 7:45am
2
set ResetOnSpawn to true or use
local newUi
player.CharacterAdded:Connect(function()
newUi = ui:Clone()
newUi.Parent = player.PlayerGui
end)
humanoid.Died:Connect(function()
newUi:Destroy
end)
2 Likes
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 7:46am
3
I had set my ResetOnRespawn to false because my loading screen and Home Screen is in the same Screen GUI and would show up every time I die if it was True
jellolemo
(jellolemo)
February 28, 2025, 7:54am
4
Then modify this
local newUi
player.CharacterAdded:Connect(function()
newUi = ui:Clone()
newUi.Parent = player.PlayerGui
end)
humanoid.Died:Connect(function()
newUi:Destroy
end)
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 7:55am
5
Isn’t that the same thing. Like just creating a new object of the GUI?
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 7:55am
6
The script has the code to start it from Loading screen
jellolemo
(jellolemo)
February 28, 2025, 7:55am
7
ye but u can modify it so it creates after your homescreen
jellolemo
(jellolemo)
February 28, 2025, 7:56am
8
with a remote/ bindable event
cjsjakaola
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 7:56am
9
Should I create 2 scripts or one with some RemoteEvents?
jellolemo
(jellolemo)
February 28, 2025, 7:57am
10
idk i would do smth like this
player.charadded:connect()
repeat task.wait () until homescreen.visible = false
–code
jellolemo
(jellolemo)
February 28, 2025, 7:58am
11
or if you have a button
button.activated:connect()
remote:fire()
remote.event:connect()
newui = …
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 7:58am
12
I have this one to detect the Player Death in the PlayerStarterScripts
character:WaitForChild("Humanoid").Died:Connect(function(player)
jellolemo
(jellolemo)
February 28, 2025, 7:58am
13
deatroy the ui in that function
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 7:59am
14
LPDied:FireServer(1)
I used RemoteEvent but the GUI script doesn’t catch it and displays output that Remote Event has been dropped
jellolemo
(jellolemo)
February 28, 2025, 8:00am
15
is that for destroying the bullet uo or creating a new one?
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 8:00am
16
Can I use like Variables in game.ReplicatedStorage to check if player is playing the game, to directly send the player’s GUI to the gamePlayFrame
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 8:01am
17
No. When player Dies I fire that remote event
LPDied:FireServer(1)
jellolemo
(jellolemo)
February 28, 2025, 8:02am
18
yes i would advise to be carefull you need to create and change variablesnon the server
HyjackGhosts
(Flame12Hyjack0Ghost)
February 28, 2025, 8:03am
19
Ok, I’ll try that and come back if its not working
jellolemo
(jellolemo)
February 28, 2025, 8:15am
20
you also dont need this, use this instead:
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
humanoid.Died:Connect(function()
--code
end)
end)