Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i change a value of a bool value with a bool value?

This line of code is not working for me. And i don't really know why. What i'm trying to do is to change a bool value with another bool value and i'm finding the bool value with a string value. I checked that i have done right and finding the values so i don't think that's an error. However it gives me this error:

"attempt to index a nil value"

game.Workspace.Values.Voting.Result.Survive.Value=game.Lighting:FindFirstChild(game.Workspace.Values.Voting.Result.Value):FindFirstChild("survival").Value


EDIT:

I solved this! In another script i swithced the parent of the model to workspace, to make it work i need to search the model in the workspace and not in the lighting. game.Workspace.Values.Voting.Result.Survive.Value=game.Workspace:FindFirstChild(game.Workspace.Values.Voting.Result.Value):FindFirstChild("survival").Value


I solved this now!

2 answers

What is the other bool value location? And the name..

1 comment

0

The bool value i want my bool value to change to is located in: game.Lighting.(Model) and is named: "survival". In lighting i have three diffrent models and the result string value is chossing one of thosse names of the models.

local a =game.Lighting:FindFirstChild(game.Workspace.Values.Voting.Result.Value)
local b = a:FindFirstChild("survival").Value

game.Workspace.Values.Voting.Result.Survive.Value = b

Tell me if this gives you the wrong outcome, or errors.

1 comment

0

No, but it gave me the error for the variable a.

This discussion is preserved as it was. New answers, comments, and votes are closed.