I'm making a script where the player uses keybinds and what not to activate certain moves. I've done the whole part of making where the player uses the move to what ever button he presses, but I can't figure out a way for that same letter to stay in the button after the player dies. And the gui automatically detects the letter even if the player died or not. This is my attempt. Thanks for your help!
Server Script
game.Players.PlayerAdded:Connect(function(Player) local char = Player.Character or Player.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") hum.Died:Connect(function() local DiedAttack = Player.PlayerGui.DiceShopGui.ScrollingFrame.Frame:WaitForChild("AttackBoostFrame") print("Player has died") Player.CharacterAdded:Wait() local PlayerGui = Player.PlayerGui print("Player has respawned") PlayerGui.DiceShopGui.ScrollingFrame.Frame.AttackBoostFrame.ProductImage.ProductTextBox.Text = "G" end) end)
Regards, Bl_ueHistory
--try putting this in a localscript in the startgui and refering to needed information.
local Player = game.Players.LocalPlayer local Humanoid = Player.Character.Humanoid while Humanoid.Health < 0 do wait() --do stuff repeat wait() until Humanoid or Humanoid.Health or Humanoid.Health > 0 end