Biss6
|
  |
| Joined: 09 Jan 2015 |
| Total Posts: 31 |
|
|
| 30 Jan 2016 09:23 PM |
the leaderboard shows, but the goals dont go up.
game.Players.PlayerAdded:connect(function(player) local stats = Instance.new("Model", player) stats.Name = "leaderstats" local points = Instance.new("IntValue", stats) points.Name = "Goals"
end)
local v = Instance.new("StringValue") v.Parent = game.Workspace.Model.Read.Bal v.Name = "LastTouched" v.Value = ""
function hit() v.Value = hit.Parent.Name end
game.Workspace.Model.Read.Bal.Touched:connect(hit)
game.Workspace.Model.Goal1.Touched:connect(function(goal1) local m = Instance.new("Message") m.Parent = game.Workspace m.Text = v.Value.." Scored a goal to Red!" local pl = game.Players:FindFirstChild(hit.Parent) pl.leaderstats.Goals.Value = pl.leaderstats.Goals.Value +1 end) game.Workspace.Model.Goal2.Touched:connect(function(goal2) local m = Instance.new("Message") m.Parent = game.Workspace m.Text = v.Value.." Scored a goal to Blue!" local pl = game.Players:FindFirstChild(hit.Parent) pl.leaderstats.Goals.Value = pl.leaderstats.Goals.Value +1 end) |
|
|
| Report Abuse |
|
|
XThane
|
  |
| Joined: 08 Apr 2009 |
| Total Posts: 2702 |
|
|
| 30 Jan 2016 09:29 PM |
Any output?
~ Who's awesome, you're awesome ~ R$81,838 Tx1,170 |
|
|
| Report Abuse |
|
|
Biss6
|
  |
| Joined: 09 Jan 2015 |
| Total Posts: 31 |
|
|
| 30 Jan 2016 09:32 PM |
| The output is normal because the script isn't wrong, or messed up it just doesn't define the last person to touch the ball and the goal value to go up 1. |
|
|
| Report Abuse |
|
|
Biss6
|
  |
| Joined: 09 Jan 2015 |
| Total Posts: 31 |
|
| |
|
XThane
|
  |
| Joined: 08 Apr 2009 |
| Total Posts: 2702 |
|
|
| 30 Jan 2016 09:55 PM |
A ball.touched function.
~ Who's awesome, you're awesome ~ R$81,838 Tx1,170 |
|
|
| Report Abuse |
|
|
Biss6
|
  |
| Joined: 09 Jan 2015 |
| Total Posts: 31 |
|
|
| 30 Jan 2016 10:12 PM |
| I have a ball touchd function but I don't know how to find who last touched the ball before thre goal.. |
|
|
| Report Abuse |
|
|
XThane
|
  |
| Joined: 08 Apr 2009 |
| Total Posts: 2702 |
|
|
| 30 Jan 2016 10:30 PM |
Just set a variable, and when the player touches it, set them as the variable.
~ Who's awesome, you're awesome ~ R$81,838 Tx1,170 |
|
|
| Report Abuse |
|
|
Biss6
|
  |
| Joined: 09 Jan 2015 |
| Total Posts: 31 |
|
|
| 30 Jan 2016 10:39 PM |
Can you give me an example pls or would this work :
a = Instance.new ("StringValue") a.Parent = game.Workspace a.Value = ""
game.Workspace.Model.Read.Bal.Touched:connect(hit) a.Value = hit.Parent.Name end)
game.Workspace.Model.Goal1.Touched:connect(function(goal1) local m = Instance.new("Message") m.Parent = game.Workspace m.Text = a.Value.." Scored a goal to Red!" a.Value.leaderstats.Goals.Value = a.Value.leaderstats.Goals.Value +1 end)
game.Workspace.Model.Goal2.Touched:connect(function(goal2) local m = Instance.new("Message") m.Parent = game.Workspace m.Text = v.Value.." Scored a goal to Blue!" a.Value.leaderstats.Goals.Value = a.Value.leaderstats.Goals.Value +1 end) |
|
|
| Report Abuse |
|
|
Biss6
|
  |
| Joined: 09 Jan 2015 |
| Total Posts: 31 |
|
|
| 30 Jan 2016 10:40 PM |
| There is supposed to be (function (hit) for the bal.touched but I forgot to put it |
|
|
| Report Abuse |
|
|