Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a gui that will show after killing an enemy?

Asked by
Glvt102 11
3 years ago

Yeah, i asked a similar question a several hours ago, but it didnt worked that time too tbh. Anyway, heres the script local enemyleader = game.ReplicatedStorage.enemyleader1 game.Workspace.spawner1.Touched:Connect(function() enemyleader.Parent = workspace if game.Workspace.enemyleader1.Humanoid.Health < 0 then game.StarterGui.KILLALLENEMIES.Enabled = true end end) The thing about spawning the enemy works, but the gui doesnt show up. Halp.

1 answer

Log in to vote
0
Answered by 3 years ago

You're mixing up StarterGui and PlayerGui. StarterGui is the server copy of a gui that is cloned to new players (or respawning characters). PlayerGui is a child of the player object, so you have to access the gui in the player and enable it there.

The simplest way is to iterate through players like so:

for _,player in pairs(game.Players:GetPlayers()) do
    player.PlayerGui.KILLALLENEMIES.Enabled = true
end
0
Thanks! Glvt102 11 — 3y
Ad

Answer this question