Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why my variable cant be read by the script?

Asked by
Annon28 23
5 years ago

im familiar with variable but today i just faced something new

print("Start")
    aaa1 = game.Workspace.Defend.Value
    aaa2 = game.Workspace.Prosecutor.Value
    game.Workspace.aaa1.HumanoidRootPart.CFrame = game.Workspace.Defendantdesk.tp.CFrame
    game.Workspace.aaa1.Torso.Anchored = true

instead of reading the variable the studio is searching for aaa1. how to make the studio read aaa1 is equal to game.Workspace.Defend.Value?

1 answer

Log in to vote
0
Answered by 5 years ago

Use FindFirstChild() without the quotation marks.

game.WorkSpace:FindFirstChild(aa1).HumanoidRootpart.CFrame

Also unless you need to use a global variable, you should use a local variable.

Ad

Answer this question