Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how to tell if a player reseted then died?

I am making this game where if you kill the enimie it tells everyone you did but how do I tell everyone that you just reseted or even

if someone resets just print ("Death On Reset")

2 comments

0

Do you mean like if you yourself reset it prints smt?

0

yes lol

2 answers

To print something on reset or when you die, you do this:

--You need to have your humanoid set as a variable
Humanoid = --That's your humanoid variable--
Humanoid.Died:Connect(function()
print("I died oof")
end)

2 comments

0

That's not what he was asking for.

0

Yes that's what he was asking for look in the comments section smh

Alright, well there are two ways to look at this, if you want to remove the Reset Button altogether, then you just need this line of code in a LocalScript

game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)

Otherwise, if you want to keep the button, you would need the following: Remote Event inside Replicated Storage (for this answer, mine is named: "ResetButton"), LocalScript inside StarterGUI, Script inside ServerScriptService

LocalScript Code:

local resetBindable = Instance.new("BindableEvent")
local remote = game.ReplicatedStorage.ResetButton
local player = game.Players.LocalPlayer

resetBindable.Event:connect(function()
    remote:FireServer(player.Name)
	print("Death on Reset")
end)

game:GetService("StarterGui"):SetCore("ResetButtonCallback", resetBindable)

Script Code:

local remote = game.ReplicatedStorage.ResetButton

function ResetCheck(player, UserID)
	local character = game.Workspace:FindFirstChild(UserID)
	character.Humanoid.Health = 0
end

remote.OnServerEvent:Connect(ResetCheck)

The Local Script makes sure that the player chose to reset by binding the function to the button. However, since we want to make sure they die on the server rather than just on the client, as the button normally does, we need to reduce the player's Health to 0 on the Server, as performed by the (Server) Script.

2 comments

0

you made a bindable event, not a remote event

0

There is both a bindable and a remote event, the bindable is made in the script, the remote event is pre-placed in the replicated storage

This discussion is preserved as it was. New answers, comments, and votes are closed.