So basically when a player touches a block it removes a point from brick colours team and gives a point to the person who touched its team, I have a StringValue with the Value as the Team Name meaning i can get the players team from that String value but how would i use that Value to select a thing (An int value in this instance).
function onTouched(hit)
local Red = game.Workspace.Game_Files.Round.RedNum
local Blue = game.Workspace.Game_Files.Round.BlueNum
local Yellow = game.Workspace.Game_Files.Round.YellowNum
local Team = hit.Parent.Team.Value
if script.Parent.Color == 'Tawny' then
Red.Value = Red.Value - 1
game.Workspace.Game_Files.Round. (This is where i want the String value to be used)
end
end
connection = script.Parent.Touched:connect(onTouched)
I've tried this but this also doesn't work, giving this error:
Workspace.Floor_Tiles.Column_1.Floor_Tile.Colouring:7: attempt to index a nil value
function onTouched(hit)
local Red = game.Workspace.Game_Files.Round.RedNum
local Blue = game.Workspace.Game_Files.Round.BlueNum
local Yellow = game.Workspace.Game_Files.Round.YellowNum
local Team = hit.Parent.Team
local TeamValue = game.Workspace.Game_Files.Round:FindFirstChild(tostring(Team)).Value
local Colour = hit.Parent.Colour
if script.Parent.BrickColor == 'Tawny' then
Red.Value = Red.Value - 1
TeamValue = TeamValue + 1
script.Parent.Color = Colour.Value
end
end
connection = script.Parent.Touched:connect(onTouched)

3 comments
From what I can read the string value that you have has a child that is an int value?
So in the player is a 'StringValue' The Value of that is 'BlueNum' which is a IntValue's Name and i need that IntValues Value, if that makes sense.
so you want a stringvalues, Value to select something in workspace