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: Why doesn't this work?

Previous Thread :: Next Thread 
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:03 PM
function onClicked()
local h = hit.Parent:findFirstChild("Humanoid")
if h == nil then return end
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if (Player ~=nil) then
Player.leaderstats.Gold.Value = Player.leaderstats.Gold.Value + 100
end
end
script.Parent.Touched:connect(onClicked)
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:04 PM
b1
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
13 Dec 2015 07:05 PM
function OnClicked(hit)
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
13 Dec 2015 07:06 PM
sorry I mis-capitalized

type 'hit' in the ()
Report Abuse
epicface123321177 is not online. epicface123321177
Joined: 23 Jul 2012
Total Posts: 514
13 Dec 2015 07:06 PM
Sorry my script didn't work out for you, here is a little tip

Make sure if your leaderstats value is ''gold'' to change it to ''gold''

Hope ya get the answer to ur problem.
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:07 PM
I just put "hit" in the ().


Still does not work:

function onClicked(hit)
local h = hit.Parent:findFirstChild("Humanoid")
if h == nil then return end
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if (Player ~=nil) then
Player.leaderstats.Gold.Value = Player.leaderstats.Gold.Value + 100
end
end
script.Parent.Touched:connect(onClicked)
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:08 PM
My leaderstats value is "Gold".
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
13 Dec 2015 07:09 PM
What is the script in?
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:10 PM
The script is in a part. There is also a clickdetector inside of the part.
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
13 Dec 2015 07:10 PM
The script is not detecting the click detector, it will detect if someone walks into it.
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:11 PM
It lets me click on the part but i just don't gain any gold..
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:13 PM
b2
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
13 Dec 2015 07:16 PM
....

Yes it will let you click because of the click detector, but the script is not linked to the click detector, the script will detect if a player TOUCHES it... hint the .
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
13 Dec 2015 07:17 PM
Hint the .Touched***
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
13 Dec 2015 07:18 PM
then how do i link it to the clickdetector
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
13 Dec 2015 07:19 PM
function onClicked(player)

end

ClickDetector.MouseClick:connect(onClick)
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