if workspace.CreatureA.Humanoid.Health == 0 then game.StarterGui.ScreenGui.Enabled = true end
I tried making a script that displays a gui when creatureA's health is zero but it didn't work
note: In the actual code all capital letters and spaces were correct .
"workspace" is deprecated. You should also use PlayerGui. Your modified script:
if game.Workspace:FindFirstChild("CreatureA") ~= nil then model = game.Workspace:FindFirstChid("CreatureA") if model:FindFirstChild("Humanoid") ~= nil then aliveobject = model:FindFirstChild("Humanoid") if aliveobject.Health == 0 then game.Players.LocalPlayer.PlayerGui.ScreenGui:Clone().Parent = game.StarterGui end end end
If you have any questions, please ask.
Use a remote event to fire to the client.
-- Local Script which clones the gui to the player. local gui = game:GetService("ReplicatedStorage").Gui -- Put in Replicatedstorage. not serverstorage. many people get this wrong. local showGui = Instance.new("RemoteEvent",gui.Parent) showGui.Name = "ShowGui" local plr = game:GetService("Players").LocalPlayer showGui.OnClientEvent:Connect(function() if not plr.PlayerGui:FindFirstChild(gui.Name) then -- So their PlayerGui doesn't overflow gui:Clone().Parent = plr.PlayerGui gui.Enabled = true end end)
now to fire to client
-- Server Script if Humanoid.Health == 0 then local players = game:GetService("Players") local plr = players[Humanoid.Parent.Name] game:GetService("ReplicatedStorage"):WaitForChild("ShowGui"):FireClient(plr) end
Bonus, it works for FE. You're welcome.