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

How can i return variables through Event?

So i trying to return variable when a Event have fired This i what i have trying

local function Ontouch()
local part = script.Parent.Position
return part
end

script.Parent.Touched:Connect(Ontouch)

local part2 = --script.Parent.Touched:Connect(function() i don't know how to reference this as

1 answer

I'm not sure what you are trying to do but try this?

local function Ontouch()
local part = script.Parent.Position
return part
end

script.Parent.Touched:Connect(Ontouch)

script.Parent.Touched:Connect(function(part2)
-- Part2 is the part that was touched
end)

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