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: Script Broke

Previous Thread :: Next Thread 
Ueskay is not online. Ueskay
Joined: 20 Jun 2014
Total Posts: 824
03 Jan 2016 06:13 PM
local character = game.Workspace.Player
local player = game.Players:GetPlayerFromCharacter(character)

function OnClicked()
player.Humanoid.Health = 0
end

script.Parent.ClickDetector.MouseClick:connect(OnClicked)

Error: Player is not a valid member of Workspace


Report Abuse
BlueKeyblades is not online. BlueKeyblades
Joined: 11 Oct 2014
Total Posts: 220
03 Jan 2016 06:27 PM
[Hot Fix]

function OnClicked(plr)
if plr:IsA('Player') and plr.Character then
plr.Character.Humanoid.Health = 0
end
end

script.Parent.ClickDetector.MouseClick:connect(OnClicked)

[Work not tested, not bested.]
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
03 Jan 2016 06:37 PM
^ Why would you check if the player is actually the classname 'player'? A bit pointless?



Report Abuse
BlueKeyblades is not online. BlueKeyblades
Joined: 11 Oct 2014
Total Posts: 220
03 Jan 2016 07:03 PM
Just in case a supercomputer takes over the server for its evil purposes and begins eradicating us all, making sure it can't use that button.

[Work not tested, not bested.]
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
03 Jan 2016 07:04 PM
Intense stuff.



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