I need a help to make appear a Gui when player kill someone

Hello, I would like to make a script when player kill someone, a little gui with write One-Kill open on his screen and close about 5secondes.

I have already the Gui but scripts I tryed to make don’t work.

I havn’t script experience and I need someone who can help me how I can make a script with the Gui open when player get a kill.

Here the Gui :


Thanks.

3 Likes

You could use something like this to detect the health, for example if the health = 0, then you make the GUI appear.

local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

char.Humanoid.HealthChanged:Connect(function(newHealth)
    print("The new health of the humanoid is:", newHealth)
end)

I do hope this helped you with your scripting in your game.

-uD0ge :dog:

But I need the Gui appear on the screen of the killer, your script will make appear on the screen of the dead player no ?

Oh woops, silly me I was doing it so the dead player would have got it. This is probably linked to How to make a "YOU KILLED.." Gui Take a look at that for some more help.

Simply, setup a RemoteEvent OnClientEvent Connection from your LocalScript within the UI then of course show the UI inside that Connected function.

Then wherever you’re damaging Players (which should be on the server) check that their Health is 0 after damaging them, if so then call the FireClient method on the RemoteEvent w/ the Player argument being the Player who attacked.

I dont know how use roblox studio very well, I m dont have lot experience in scripting. Can you send a screen like what look like to setup the RemoteEvent thing, or link of an video tutorial ?

1 Like

ReplicatedStorage is a good place to put RemoteEvents, you could name your’s “DisplayKill”.

Then inside your LocalScript you can Connect it up like:

local ReplicatedStorage = game:GetService("ReplicatedStorage");

local function Display()
    --// Show the UI
end

ReplicatedStorage.DisplayKill.OnClientEvent:Connect(Display);

If you haven’t used RemoteEvents before then I suggest you take a read of this article:

1 Like

I tryed to do like you said and see the RemoteEvents things , but still not working.

local ReplicatedStorage = game:GetService("ReplicatedStorage");

local function Display()
	script.Parent.Visible = true
	wait(5)
	script.Parent.Visible = false

end
ReplicatedStorage.DisplayKill.OnClientEvent:Connect(Display);

The localscript was put in the frame of my killGui and the RemoteEvents was put in ReplicatedStorage and named DisplayKill.
Baseplate - Roblox Studio 28_04_2020 16_30_29

Everything checks out, could you show where you’re firing the RemoteEvent?

Sorry, I m not english and I don’t understand all things about roblox studio, what are you talking about ?

OnClientEvent is fired when the FireClient/FireAllClients method is called, you must call it otherwise this will never do anything.

1 Like
local ReplicatedStorage = game:GetService("ReplicatedStorage");

local function Display()
	script.Parent.Visible = true
	wait(5)
	script.Parent.Visible = false

end
ReplicatedStorage.DisplayKill.OnClientEvent:Connect(Display);

remoteEvent:FireServer()

I need call it like that or something else ?
Sorry to take your time , I really dumb with scripting :sweat_smile:

Please go back to what I said.

Oh, ok I understand what you talking about now. So I need to make a script with in the check if player kill someone and fireserver if he killed someone. Now the problem I don’t j=know how to script it, have you any tuotorial to do it ?
Sorry to wast your time.

I don’t know of any tutorials on it, but I can give some code as an example:

local ReplicatedStorage = game:GetService("ReplicatedStorage");

--// This should be where you damage the Player
if (PlayerToDamage.Health == 0) then --// If their Health is equal to 0
     ReplicatedStorage.DisplayKill:FireClient(PlayerWhoAttacked); --// Fire the Player who attacked, this makes the OnClientEvent fire
end

Not at all, I’m happy to help!

1 Like

When I put your

local ReplicatedStorage = game:GetService("ReplicatedStorage");

--// This should be where you damage the Player
if (PlayerToDamage.Health == 0) then --// If their Health is equal to 0
     ReplicatedStorage.DisplayKill:FireClient(PlayerWhoAttacked); --// Fire the Player who attacked, this makes the OnClientEvent fire
end

The script tell me PlayerToDamage and PlayerWhoAttacked is Unknow Global.

These are placeholder values for what they’re meant to be, you should be integrating it into your Script which handles damaging.

I m so sorry, but I really don’t how scripting, how should I integrating wich handles damaging things ?

Could you show your Script which damages players?

I made axatly the same thing you send to me, it is wrong ?