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
5 years ago

How do you access "touchedman" in a formula

function ontouch(hit)
    local touchedman = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent)
    if player then

    game.Workspace.touchedman.Folder.BoolValue.Value = true

    end
end

script.Parent.Touched:Connect(ontouch)

2 answers

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

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

touchedman.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 — 5y
Ad
Log in to vote
1
Answered by
metryy 306 Moderation Voter
5 years ago
Edited 5 years ago

Not sure if I understand your question correctly but:

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

Answer this question