|
| 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
|
  |
| Joined: 23 Mar 2011 |
| Total Posts: 238 |
|
| |
|
|
| 22 Jul 2015 01:16 AM |
D:
r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury] |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 22 Jul 2015 01:24 AM |
.-.
r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury].-. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 22 Jul 2015 01:31 AM |
Nope
r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury] |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 22 Jul 2015 01:35 AM |
repeat is invalid
r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury] |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 22 Jul 2015 05:34 AM |
Or you could, you know, use something like this:
while plr.Character == nil do wait() end
|
|
|
| Report Abuse |
|
|
|
| 22 Jul 2015 11:07 AM |
repeat is still invalid
r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury] |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2015 11:17 AM |
omg
r u a dldo or sumthin [Add 3.4k posts, kuzicalovre123, canterbury] |
|
|
| Report Abuse |
|
|