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

using a local variable in a formula?

Asked by
danglt 185
6 years ago

How do you access "touchedman" in a formula

01function ontouch(hit)
02    local touchedman = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent)
03    if player then
04 
05    game.Workspace.touchedman.Folder.BoolValue.Value = true
06 
07    end
08end
09 
10script.Parent.Touched:Connect(ontouch)

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
1game.Workspace[touchedman.Name].Folder.BoolValue.Value = true

or you could use touchedman.Character (if its their character)

1touchedman.Character.Folder.BoolValue.Value = true
0
i think this is what your trying to do because of the line "game.Workspace.touchedman.Folder.BoolValue.Value = true" the8bitdude11 358 — 6y
Ad
Log in to vote
1
Answered by
metryy 306 Moderation Voter
6 years ago
Edited 6 years ago

Not sure if I understand your question correctly but:

1script.Parent.Touched:Connect(function(obj)
2    workspace[obj.Parent].Folder.BoolValue.Value = true -- Goes into workspace and tries to find the player who touched the object
3end)

Answer this question