generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Click to kill(Help!)

Previous Thread :: Next Thread 
iddash is not online. iddash
Joined: 19 Jul 2014
Total Posts: 1
11 Apr 2017 09:00 AM
Ok so i want the player who clicked the gui to die
Here is the code(it is in a local script):
script.Parent.MouseButton1Click:connect(function()
local player = game.Players.LocalPlayer
local humanoid = game.Workspace.player:FindFirstChild(player)
if humanoid then
local chec = humanoid:findFirstchild("Humanoid")
if chec then
chec.Health = 0
end
end

end)

In the output, it says "player is not a valid member of Workspace"
what is wrong?


Report Abuse
AngusOP_YT is not online. AngusOP_YT
Joined: 24 Apr 2016
Total Posts: 510
11 Apr 2017 09:03 AM
script.Parent.MouseButton1Click:connect(function()
if Humanoid then
local chec = Humanoid:FindFirstChild("Humanoid")
if chec then
chec.Health = 0
end
end
end)


local player = game.Players.LocalPlayer
local humanoid = game.Workspace.player:FindFirstChild(player)

try this
Report Abuse
MadlyHomerunHitter is not online. MadlyHomerunHitter
Joined: 28 May 2016
Total Posts: 781
11 Apr 2017 09:05 AM
If humanoid
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
11 Apr 2017 09:09 AM
There is no need to overcomplicate it like that all of you are wrong lol.

script.Parent.MouseButton1Click:connect(function()

local Player = game.Players.LocalPlayer
local Humanoid = Player.Character.Humanoid

Humanoid.Health = nil



end)


#code print(string.rep("Lit",5))
Report Abuse
QuantumNexsus is not online. QuantumNexsus
Joined: 09 Nov 2014
Total Posts: 2451
11 Apr 2017 09:09 AM
Also why would you need to check if its a humanoid clicking lol i dont see how a part is going to click it do you?.


#code print(string.rep("Lit",5))
Report Abuse
COOKCASE22 is not online. COOKCASE22
Joined: 01 Sep 2013
Total Posts: 818
11 Apr 2017 09:40 AM
^
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image