how do i make a revive with bandage on roblox studio?, i want a e to revive button to appear when near a dead player with a bandage
You shouldn’t ask other people to code entire systems for you.
I’ll tell you how you could do it though, so first set Players.RespawnTime to infinity to avoid the player respawning earlier (you can always manually respawn the player using Player:LoadCharacter()). Then whenever a player dies just add a proximity prompt like so:
local players = game:GetService "Players"
players.PlayerAdded:Connect(function(plr: Player)
plr.CharacterAdded:Connect(function(character: Model)
local humanoid = character:WaitForChild "Humanoid"
humanoid.Died:Connect(function()
local prompt = Instance.new "ProximityPrompt"
prompt.ObjectText = plr.Name
prompt.ActionText = "Revive"
prompt.HoldDuration = 5
prompt.Triggered:Connect(function(plr_who_triggered: Player)
--revive function here, do some revive code
local old_pos = character.PrimaryPart.Position
plr:LoadCharacter()--reset the character
plr.Character:PivotTo(CFrame.new(old_pos))
end)
prompt.Parent = character.PrimaryPart
end)
end)
end)
and that’s kind of it, I didn’t test this so yeah. This is just a simple example.
I don’t know what you mean by ‘bandage’. Try adding more details next time.
Hope this helps.
By ‘Bandage’, I meant a tool that revives the player
oh, just check if they have that tool:
--previous code
prompt.Triggered:Connect(function(plr_who_triggered:Player)
if not plr_who_triggered.Backpack:FindFirstChild "Bandage" and not plr_who_triggered.Character:FindFirstChild "Bandage" then return end
local old_pos = character.PrimaryPart.Position
plr:LoadCharacter()
plr.Character:PivotTo(CFrame.new(old_pos))
end)
--other code
And now it only works if the player has a tool named ‘bandage’ in their backpack or equipped
how do i add the bandage detection to the script?
I already told you, just add this line:
if not plr_who_triggered.Backpack:FindFirstChild "Bandage" and not plr_who_triggered.Character:FindFirstChild "Bandage" then return end
to the proximity prompt 's triggered connection
i dont know if this is what you meant but it still shows the revive button without the bandage