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

How can i return variables through Event?

Asked by 4 years ago

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

Log in to vote
0
Answered by
zomspi 541 Moderation Voter
4 years ago

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)
Ad

Answer this question