why does this script work but the other one doesnt?
-- this script works v
player = workspace.Goals.Ball.LastKick
transfer = workspace.Transfer
function OnGoalChanged()
workspace.Transfer.Value = math.ceil(((game.Players:FindFirstChild(player.Value).leaderstats.Overall.Value + game.Players:FindFirstChild(player.Value).leaderstats.Goals.Value + game.Players:FindFirstChild(player.Value).leaderstats.Assists.Value) /16)+10)
script.Parent.Goal.Scorer.Text = player.Value:upper()
script.Parent.Goal.Time.Text = workspace.minutes.Value .. "'"
script.Parent.Goal.Frame.TextLabel.Text = "GOALS: " .. game.Players:FindFirstChild(player.Value).leaderstats.Goals.Value .. " ASSISTS: " .. game.Players:FindFirstChild(player.Value).leaderstats.Assists.Value .. " VALUE $" .. transfer.Value .. "M (NOV. 2015)"
script.Parent.Flag.Image = "rbxassetid://" .. game.Players:FindFirstChild(workspace.Goals.Ball.LastKick.Value).hiddenstats.flagy.Value
script.Parent.Camera.Disabled = false
script.Parent.Visible = true
wait(25)
script.Parent.Visible = false
end
workspace.RedScore.Changed:connect(OnGoalChanged)
workspace.BlueScore.Changed:connect(OnGoalChanged)
-- this doesnt v
player = workspace.Goals.Ball.LastKick
transfer = workspace.Transfer
goal = script.Parent.Goal
parent = script.Parent
transfer = workspace.Transfer
camera = parent.Camera
flag = parent.Flag
function OnGoalChanged()
local playervalue = game.Players:FindFirstChild(player.Value)
transfer.Value = math.ceil(((playervalue.leaderstats.Overall.Value + playervalue.leaderstats.Goals.Value + playervalue.leaderstats.Assists.Value) /16)+10)
goal.Scorer.Text = player.Value:upper()
goal.Time.Text = workspace.minutes.Value .. "'"
goal.Frame.TextLabel.Text = "GOALS: " .. playervalue.leaderstats.Goals.Value .. " ASSISTS: " .. playervalue.leaderstats.Assists.Value .. " VALUE $" .. transfer.Value .. "M (NOV. 2015)"
flag.Image = "rbxassetid://" .. playervalue.hiddenstats.flagy.Value
camera.Disabled = false
parent.Visible = true
wait(25)
parent.Visible = false
end
workspace.RedScore.Changed:connect(OnGoalChanged)
workspace.BlueScore.Changed:connect(OnGoalChanged)
--please tell me why this is crushing my brain