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 » Scripting Helpers
Home Search
 

Re: Click to add to player

Previous Thread :: Next Thread 
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
12 Jun 2013 02:38 PM
--I'm making a click regen script where the model is placed inside the player that clicked (yes I suck at it)
--They pay cash to spawn the car. Doesn't work and no outputs
--Help? Script so far:

object = game.Lighting.Ferrari458
if (object ~= nil) and (object ~= game.Lighting) then

model = object

while true do
wait(.01)
backup = model:clone()

function onClicked(Clicked)
model = backup:clone()
model.Parent = Clicked.findFirstChild("Humanoid")
if Clicked.findFirstChild("Humanoid") and Clicked:findFirstChild("leaderstats").Money.Value >= 10000 then
Clicked:findFirstChild("leaderstats").Money.Value = Clicked:findFirstChild("leaderstats").Money.Value - 10000
model:MakeJoints()
end
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
12 Jun 2013 02:42 PM
Instead of Clicked:findFirstChild("leaderstats") would it be player:findFistChild("leaderstats") or does that have a different function?
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Jun 2013 02:44 PM
You defined your player as Clicked, also FindFirstChild is a method, not a property. Clicked:FindFirstChild("Humanoid")
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
12 Jun 2013 02:48 PM
yea my bad. Still doesn't want to work though
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Jun 2013 02:53 PM
Since I'm somewhat nice, I'll rewrite it for you. Just give me a minute or two...
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
12 Jun 2013 02:53 PM
Thanks man
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Jun 2013 02:58 PM
object = game.Lighting.Ferrari458

script.Parent.ClickDetector.MouseClick:connect(function(player)
if player and player.Character and object and player.leaderstats and player.leaderstats.Money.Value >= 10000 then
player.leaderstats.Money.Value = player.leaderstats.Money.Value - 10000
clone = object:Clone()
clone.Parent = player.Character.Humanoid
clone:MakeJoints()
end
end)
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Jun 2013 02:58 PM
Keep in mind I don't really know what you want to do in this script, but try that.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
12 Jun 2013 02:59 PM
Thanks so much, it works
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
12 Jun 2013 02:59 PM
Why do you need to check is a humanoid clicked it? Only Players can click it anyway. Remove that and the and after it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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