This is in a local script, but it sort of needs to be in a local script so I'm confused what to do. is it the square brackets? Please help.
--Your wins.
local yw = game.Players.LocalPlayer.leaderstats.Wins.Value
--Your losses.
local yl = game.Players.LocalPlayer.leaderstats.Losses.Value
--Button.
local button = script.Parent["Flip a card"]
--Your Move.
local ym = script.Parent["Your move"]
--Their Move.
local tm = script.Parent["Their move"]
--Winner board.
local wb = button.Label
--Function for button.
function pressed()
--Your move number.
local ymn = math.random(1,10)
--Their move number.
local tmn = math.random(1,10)
--Labelling.
ym.Text = ymn
tm.Text = tmn
--Logic.
if ymn > tmn then
wb.Text = "You win!"
yw = yw + 1
else
wb.Text = "You lost!"
yl = yl + 1
end
end
--binding function
button.MouseButton1Down:connect(pressed)
When I put it into a Normal script and modded it it still wouldn't work
--Your wins.
local yw = script.Parent.Parent.Parent.Parent.leaderstats.Wins.Value
--Youre losses.
local yl = script.Parent.Parent.Parent.Parent.leaderstats.Losses.Value
--Button.
local button = script.Parent["Flip a card"]
--Your Move.
local ym = script.Parent["Your move"]
--Their Move.
local tm = script.Parent["Their move"]
--Winner board.
local wb = button.Label
--Function for button.
function pressed()
--Your move number.
local ymn = math.random(1,10)
--Their move number.
local tmn = math.random(1,10)
--Labelling.
ym.Text = ymn
tm.Text = tmn
--Logic.
if ymn > tmn then
wb.Text = "You win!"
yw = yw + 1
else
wb.Text = "You lost!"
yl = yl + 1
end
end
--binding function
button.MouseButton1Down:connect(pressed)
