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

[REQ] LocalPlayer kill script GUI?

Asked by 7 years ago

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 :]

0
your screenshot doesn't work User#15461 0 — 7y

2 answers

Log in to vote
0
Answered by
farrizbb 465 Moderation Voter
7 years ago
Edited 7 years ago
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.

0
^ didnt work :( NotSpecialCharacters 0 — 7y
0
it should is it in a local script and is the script in a textbutton farrizbb 465 — 7y
0
yes NotSpecialCharacters 0 — 7y
0
okay try script.Parent farrizbb 465 — 7y
View all comments (14 more)
0
I did. Didnt work :/ NotSpecialCharacters 0 — 7y
0
Does it work now? farrizbb 465 — 7y
0
Nope. NotSpecialCharacters 0 — 7y
0
Would you like a download of the gui? So you can see what to do??? NotSpecialCharacters 0 — 7y
0
Just a picture but , it should work farrizbb 465 — 7y
0
i only want a picture not a file i don't understand why it doesn't work farrizbb 465 — 7y
0
I sent a picture off the gui tho.. cant you edit the script then send it back too me? NotSpecialCharacters 0 — 7y
0
I send a file of the gui* (also, what a pic off?) NotSpecialCharacters 0 — 7y
0
the properties and stuff and all the children etc farrizbb 465 — 7y
0
What? I sent you the gui. Cant you just do it then send it back? NotSpecialCharacters 0 — 7y
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. farrizbb 465 — 7y
0
Also i asked for a picture not a download so just a picture link . farrizbb 465 — 7y
0
Great it'd be appreciated if you accepted the answer! farrizbb 465 — 7y
Ad
Log in to vote
-1
Answered by 4 years ago

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!

0
Hi! I can answer this question. 2nJe7eV9h 0 — 3y

Answer this question