Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help Debugging GUI Script that uses Intance.new?

Asked by 8 years ago
--Variables

repStorage = game:GetService("ReplicatedStorage")
Death = repStorage:WaitForChild("d")
repeat wait() until game:GetService("Players")
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
char = Player.Character
Humanoid = char:WaitForChild("Humanoid")
Character = game.Players.LocalPlayer.Character or Player.CharacterAdded:wait()
HumanoidRoot = Character:WaitForChild("HumanoidRootPart")
Health = Character.Humanoid.Health

--Fire That Server Boy

Death:FireAllClients()

--function
if Health <= 5 then
    function onTouch(hit)
        local Human = script.Parent.findFirstChild("Humanoid")
        local Target = game.Players:GetPlayerFromCharacter(Human.Parent)

        if Human then

            local KillButton = Instance.new("ScreenGui")
            KillButton.Name = "KillButton"              
            KillButton.Parent = Target.PlayerGui
            local KillButton2 = Instance.new("TextButton")
            KillButton2.Parent = KillButton
            KillButton2.Position = UDim2.new(0.2,0,0.8,0)
            KillButton2.Name = "Kill"
            KillButton2.Text = "Kill"
            KillButton2.FontSize = "Size36"
            KillButton2.Font = "SourceSansItalic"       
            KillButton2.Style = "RobloxRoundDropdownButton"
            local SaveButton = Instance.new("ScreenGui")
            SaveButton.Name = "SaveButton"
            local SaveButton2 = Instance.new("TextBox")
            SaveButton.Parent = Target.PlayerGui
            SaveButton2.Parent = SaveButton
            SaveButton2.Position = UDim2.new(0.6,0,0.8,0)
            SaveButton2.Name = "Save"
            SaveButton2.Style = "RobloxRoundDropdownButton"
            SaveButton2.Text = "Save"
            SaveButton2.FontSize = "Size36"
            SaveButton2.Font = "SourceSansItalic"
            local WorkKill = game.ServerStorage.KillButtonScript:Clone()
            WorkKill.Parent = KillButton2
            WorkKill.Disabled = false
            local WorkSave = game.ServerStorage.SaveButtonScript:Clone()
            WorkSave.Parent = SaveButton2
            WorkSave.Disabled = false

        end
    end
    char.Torso.Touched:connect(onTouch)
end

It's supposed to give the player who touches the body of the dead player (Player under five health which is dead on the floor that I have another script for.) 2 GUIs, one that says kill and another one that says save. The GUI's don't show up at all.

Answer this question