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: Anyone know whats wrong with this script?

Previous Thread :: Next Thread 
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:11 AM
So I want my game to be able to "buy sparkles with coins", and im using a script which after taking your coins, it will send the sparkled (are in the script) to your torso, but theres a flaw

Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Coins

function onClick()
if Cash.Value >= 200 then
Cash.Value = Cash.Value - 200
c=click.Parent:FindFirstChild("Humanoid")
script.Parent.blue:Clone().Parent=c.Parent.Torso
end
end

script.Parent.MouseButton1Click:connect(onClick)

anyone see an issue?

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
bomblover is not online. bomblover
Joined: 23 Mar 2011
Total Posts: 238
22 Jul 2015 01:13 AM
"click" isn't defined
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:16 AM
D:

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
bomblover is not online. bomblover
Joined: 23 Mar 2011
Total Posts: 238
22 Jul 2015 01:16 AM
function onClick(click)


if c then
script.Parent.blue:Clone().Parent = blahblagblah
end
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:21 AM
Then the function doesnt work at the bottom...


can you like copy it and paste it with the right stuff

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:24 AM
.-.

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury].-.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 01:28 AM
you're using a local script (or at least you should be), so use local player

local plr = game.Players.LocalPlayer
local char = plr.Character or repeat wait() until player.Character
local leaderstats = plr:WaitForChild("leaderstats")
local cash = leaderstats:WaitForChild("Coins")

function onClick()
if cash.Value >= 200 then
cash.Value = cash.Value - 200
local torso = char:FindFirstChild("Torso")
if torso then
script.Parent.blue:Clone().Parent = torso
else
print("no torso found")
end
end
end

script.Parent.MouseButton1Click:connect(onClick)

try that?
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 01:29 AM
if the torso doesn't exist also, you may want to give the player a refund too
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:29 AM
its a gui button,

but ill try it

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:31 AM
Nope

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 01:31 AM
of course.. all of your gui manipulation should be handled on the client.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 01:31 AM
if that doesn't work then you're either not using a local script or you're doing something wrong

that script should work or at least give you output
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:35 AM
repeat is invalid

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 01:36 AM
repeat wait() until player.Character

there is nothing wrong with this i think

http://wiki.roblox.com/index.php?title=Loops#Repeat
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 01:54 AM
Would this work? If i kept the sparkles in the lighting?

Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Coins

function onClick()
if Cash.Value >= 1500 then
Cash.Value = Cash.Value - 1500
local sparkles = game.lighting.Parent.blue:Clone().Parent=c.Parent.Torso

end
end

script.Parent.MouseButton1Click:connect(onClick)

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
T00NAMI is not online. T00NAMI
Joined: 10 Mar 2013
Total Posts: 211
22 Jul 2015 05:28 AM
Your script instawin looks good, but I think the repeat error is coming from this:

Your script:
local plr = game.Players.LocalPlayer
local char = plr.Character or repeat wait() until player.Character

Fixed Script:
local plr = game.Players.LocalPlayer
local char = plr.Character or repeat wait() until plr.Character
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
22 Jul 2015 05:34 AM
Or you could, you know, use something like this:

while plr.Character == nil do wait() end

Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 11:07 AM
repeat is still invalid

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
Report Abuse
ConnorHurtsU is not online. ConnorHurtsU
Joined: 05 Dec 2009
Total Posts: 4810
22 Jul 2015 11:17 AM
omg

r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury]
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