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

[REQ] LocalPlayer kill script GUI?

Hello. Me and my mate are making a tycoon. I'm making a gui for it because I'm bored lol BUT I wanna make a reset character button This is what my workspace and scripts look like

http://screenshot.sh/m3Cokv6QPxAsJ

and the script I'm trying to use.

local player = game.Players.LocalPlayer
game.Players.LocalPlayer:BreakJoints()

So when you click the button It will kill you. Please help :]

1 comment

0

your screenshot doesn't work

2 answers

local player = game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Down:connect(function()--if the gui is clicked this happens
    if player.Character and player.Character:FindFirstChild("Humanoid") then
        player.Character.Humanoid.Health = 0-- changes health to 0
    end
end

From what i see it seems as you are fairly new to Studio so here's how it should be in explorer.StarterGui>ScreenGui>Frame>TextBox. Sorry if i mistaken your level of scripting.

18 comments

0

^ didnt work :(

0

it should is it in a local script and is the script in a textbutton

0

yes

0

okay try script.Parent

0

I did. Didnt work :/

0

Does it work now?

0

Nope.

0

Would you like a download of the gui? So you can see what to do???

0

Just a picture but , it should work

0

i only want a picture not a file i don't understand why it doesn't work

0

I sent a picture off the gui tho.. cant you edit the script then send it back too me?

0

I send a file of the gui* (also, what a pic off?)

0

the properties and stuff and all the children etc

0

What? I sent you the gui. Cant you just do it then send it back?

0

Dude the reason it doesn't work is probably because you are just copy and pasting it and not changing it to your desires, me doing everything for you would be called spoon feeding.

0

Also i asked for a picture not a download so just a picture link .

0

Great it'd be appreciated if you accepted the answer!

This should work (put the script where the text button is the ‘parent’)

script.Parent.MouseClick:Connect(function()
   game.Players.LocalPlayer.Character.Humanoid.Health = 0
end

Hope this helped you!

1 comment

0

Hi! I can answer this question.

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