I need help with my kill-gui script

Hi, I’m making a small FPS game, and I need help with my on-kill GUI, which doesn’t show up.
When a player is killed their camera is sent to the killer’s head, showing the player who died who killed them.
I wanted to add a bit more flair to this, since I already had the killcam scripted, I used this guide to help me set up the GUI pop-up. The popups in my game are this:
The frame has an ImageLabel and a TextLabel, and the frames are the letterbox.

image

In-game, it should look like this, pretend this dummy killed you.

But as I said earlier, it does not show up. Here’s how it currently looks in-game, the killcam works but the popup does not.
ezgif.com-gif-maker

I followed the guide and tried to modify the script to work with my GUIs. I’m not sure if there’s something wrong with the properties or the script.
This is the script:

local frame = script.Parent.Frame
local player = game.Players.LocalPayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

humanoid.Died:Connect(function()
	local murder = character.Humanoid:FindFirstChild("creator")
	local murderCharacter = murder.Value.Character
	local murderName = murder.Value.Name
	
	if murder.Value then
		script.Parent.bar.Visible = true
		frame.Visible = true
		frame.TextLabel.Text = murderName.." has killed you!"
		wait(8)
		script.Parent.bar.Visible = false
		frame.Visible = false
	end
end)

I’m not sure what’s wrong with it, but if you do, then please don’t hesitate to tell! Thanks for reading, I hope this can help myself and others learn.

2 Likes

Any errors in the output? I don’t see where you’re setting the camera in your script. If your killcam works, that means the creator tag has been found, I assume. Are you sure you’re referencing everything correctly? Can you try checking the explorer via runtime (check gui properties) and adding prints to your code.

I used a different killcam script, the one in the video immediately heads to the character’s head. I found a different script without the GUI, and modified it a bit. I added prints to my code, telling me when the GUI appears and disappears.
Not sure if this has always been here, I look at the console every time I test my game, but I noticed this:
image
Not sure what is happpening, line 2 is very important for the GUI line 2 is
local player = game.Players.LocalPayer or game.Players.PlayerAdded:Wait() , which the other variables rely on. I’m going to re-watch the video and see where I messed up.

You have misspelt local player. Funny I didn’t catch that error.

1 Like

Wow… I feel really dumb right now
I’ll be sure to proofread my scripts from now on, thanks for helping!
This is how it looks in-game:

Also if you want to try out the game, click this. It’s currently in testing and I’m almost ready for the full release.

And Poodispenserere may or may not be a reference to the iconic team-based shooter game by Valve

1 Like