skadadlea
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 1034 |
|
|
| 10 Apr 2014 12:14 PM |
for example
if [players money value] = >20 then |
|
|
| Report Abuse |
|
|
skadadlea
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 1034 |
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Apr 2014 12:18 PM |
for _,v in pairs(game.Players:GetPlayers()) do if v:IsA("Player") then if pcall(function() if v.LeaderStats.Money >= 20 then do(stuff)--Obviously I don't know what you want to do, note the do(stuff) function. else do(differentStuff) end end) then return else return end end end
This should work, if it doesn't, just post here, please include a stack trace and error.
--Shira |
|
|
| Report Abuse |
|
|
skadadlea
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 1034 |
|
|
| 10 Apr 2014 12:22 PM |
| will this work locally for each player? |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Apr 2014 12:26 PM |
It runs globally, but it iterates through each player to check their Money leaderstat. Then, depending on what the Money leaderstat is (In this case 20), it'll do either one thing, or another.
--Shira |
|
|
| Report Abuse |
|
|
skadadlea
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 1034 |
|
|
| 10 Apr 2014 12:31 PM |
here is the full script, got an error however...
script.Parent.MouseButton1Down:connect(function() local pt = game.ReplicatedStorage.Part:Clone() for _,v in pairs(game.Players:GetPlayers()) do if v:IsA("Player") then if pcall(function() if v.LeaderStats.Money >= 20 then pt.Parent = game.Workspace pt.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.p + Vector3.new(0,5,0) --Places the part 5 studs above you, is that what you want? end
error: 'end expected to close function at line 5' |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Apr 2014 12:37 PM |
Your script has a lot of hanging ends. I'm assuming you're plopping the money check into the GUI click that you asked about earlier, am I right? Try this. (Oh, and if at all possible, please thank me in the description for helping you debug or something, much appreciated.)
script.Parent.MouseButton1Down:connect(function() for _,v in pairs(game.Players:GetPlayers()) do if v:IsA("Player") then if pcall(function() if v.LeaderStats.Money >= 20 then local pt = game.ServerStorage.Part:Clone() pt.Parent = game.Workspace pt.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.p + Vector3.new(0,5,0) --Places the part 5 studs above you, is that what you want? else return end end) then return else return end end end end)
--Shira
|
|
|
| Report Abuse |
|
|
skadadlea
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 1034 |
|
|
| 10 Apr 2014 12:53 PM |
| yes you are right. Unfortunately it is not doing anything, and nothing is coming up in output relevant to the script. |
|
|
| Report Abuse |
|
|
skadadlea
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 1034 |
|
|
| 10 Apr 2014 12:53 PM |
| also I would be happy to credit you |
|
|
| Report Abuse |
|
|
skadadlea
|
  |
| Joined: 05 Oct 2010 |
| Total Posts: 1034 |
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Apr 2014 01:23 PM |
| Do you have more than 20 money? Then it should work. I didn't spam my script full of debug lines, which I normally do. |
|
|
| Report Abuse |
|
|