|
| 29 Jun 2013 02:07 PM |
It's supposed to kill the player that touches it, give it 500 Cash, say it won, and change the bricks transparency to 0.
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then humanoid.Health = 0 local user = game.Players:GetPlayerFromCharacter(hit.Parent) local stats = user:findFirstChild("leaderstats") if stats ~= nil then local cash = stats:findFirstChild("Cash") cash.Value = cash.Value + 500 wait() print("Player won!") wait() local h = Instance.new("Message") h.Parent = game.Workspace h.Text = "" .. user.Name .. " Has Reached The Finish Line And Won 1st Place! Awarding 500 Coins..." wait(2.5) h:remove() wait(3) script.Parent.Parent.FinishLine.Transparency = 0 wait(2) script.Parent.Parent:remove() end end end
script.Parent.Touched:connect(onTouch)
Sorry to be in the wrong topic, But i need help fast! |
|
|
| Report Abuse |
|
|
| |
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 29 Jun 2013 02:12 PM |
Does all the stuff you defined in there exist? No output either? Are you sure it's Cash not Money or something else?
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 02:12 PM |
| Go to youtube and watch stickmasterluke's scripting tutorials |
|
|
| Report Abuse |
|
|
guy999p
|
  |
| Joined: 01 Dec 2008 |
| Total Posts: 2749 |
|
|
| 29 Jun 2013 02:13 PM |
| Lol your are going to use this to exploit arnt you. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 29 Jun 2013 02:13 PM |
^ Do anything but that
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jun 2013 02:13 PM |
I cant run it in RBLX studio because it gives you no leaderboard in roblox studio test.
It tops working when it gets to where it gives the Cash. And yes, there is a Cash leaderboard. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 29 Jun 2013 02:14 PM |
Alright. You can't run it in play solo?
Test > Play Solo or F6 I think
then you'd have your output.
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 02:15 PM |
| I can, but the leaderboard doesn't load in test solo mode. |
|
|
| Report Abuse |
|
|
ufo973
|
  |
| Joined: 14 Apr 2009 |
| Total Posts: 20414 |
|
|
| 29 Jun 2013 02:16 PM |
If it's Local User then i think it should work.
~ When the rest of ATR is being Stupid, I'm still here to Help ~ |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 29 Jun 2013 02:18 PM |
No I believe I've seen the problem.
"function onTouch(part)"
You are passing this argument "part" but it never shows up in the code. What does show up is "local user = game.Players:GetPlayerFromCharacter(hit.Parent)"
"hit". In the first line make part hit. I'm going to check real quick and make sure the argument in the function returns the part that touched it, but I believe I've found your error.
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 29 Jun 2013 02:19 PM |
I'll debug it entirely. It has some other problems.
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 02:21 PM |
| What's with all the deprecated methods. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 29 Jun 2013 02:25 PM |
function onTouch(part)
if part.Parent:FindFirstChild("Humanoid") then local humanoid = part.Parent:FindFirstChild("Humanoid") humanoid.Health = 0
local user = game.Players:GetPlayerFromCharacter(part.Parent) local stats = user:findFirstChild("leaderstats")
if stats then local cash = stats:FindFirstChild("Cash") cash.Value = cash.Value + 500 end
local h = Instance.new("Message") h.Parent = workspace h.Text = "" .. user.Name .. " Has Reached The Finish Line And Won 1st Place! Awarding 500 Coins..." wait(2.5) h:Destroy() -- when this was made destroy wasn't made yet. Destroy is better wait(3) script.Parent.Parent.FinishLine.Transparency = 0 wait(2) script.Parent.Parent:Destroy() end end
I think that is correct
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 29 Jun 2013 02:26 PM |
@evolved this code was made a long time ago for those buttons at the end of obbies at tycoons. :remove() is the only one that is deprecated, and that sounds like something off of the wiki.
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
| |
|