How would I go about making the player not taking damage/dying after resetting? I’ve tried doing it through the bindable event thing but it did not work.
You can use StarterGui:SetCore("ResetButtonCallback", false)
to disable the functionality of the reset button overall.
This is the script I’m using and I also don’t want to disable it entirely.
local resetBindable = Instance.new("BindableEvent")
resetBindable.Event:Connect(function()
game.ReplicatedStorage.Events.HandlerEvent:FireServer("Respawn")
end)
local successReset = false
coroutine.wrap(function()
while not successReset do
successReset = pcall(function()
game:GetService("StarterGui"):SetCore("ResetButtonCallback", resetBindable)
end)
if successReset then
break
end
task.wait(.2)
end
end)()
return CC
what script is this? LocalScript, ServerScript, ModuleScript?
Localscript in any of the viable places where a localscript would run on player join.
It’s a modulescript located in replicatedstorage.
So is anyone able to assist me with this or not?
local bind = Instance.new("BindableEvent")
bind.Event:Connect(function() -- Empty anonymous function
print("Busy wait")
end)
game:GetService("StarterGui"):SetCore("ResetButtonCallback", bind) -- Bind the reset to the BindableEvent, which does nothing
That should make the death script functionally useless
Thank you so much, and where would I place the script at because currently the script is located inside of ReplicatedStorage inside of a ModuleScript.
SetCore
only works on the client, just place it in a LocalScript
A good place for the script itself is in StarterPlayerScripts
Also just an FYI, you may have to do some pcall
checks to ensure the core is loaded, if it’s not that script can throw an error
You can use humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
to basically un-dead the player after they die, even if their health is 0. Example:
local starterGui = game:GetService("StarterGui")
local hum = -- Path to humanoid
local resetBind = Instance.new("BindableEvent")
starterGui:SetCore("ResetButtonCallback", resetBind)
local function onResetBind()
hum:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
end
resetBind.Event:Connect(onResetBind)
If, after this, your character dies again after taking damage a second time, just set up a humanoid.Died
connection that sets Dead to false and disconnects when the player finally respawns.
This was the only one that worked for me, ty