Hi I am making an obby where when you touch a brick you get teleported somewhere however this is not working for me. I have recently had to change all of the scripts and decided to switch to one module script and then tons of scripts that require it so that I would only have to change the script once. This does not seem to be working. Here are the scripts > Module Script
local _M = {}
function _M.lose()
end
function _M.win()
Ting = 0
print("test")
script.Parent.Touched:connect(function(p)
print("test2")
if p.Parent:findFirstChild("Torso") and Ting == 0 then
Ting = 1
local plyr=game.Players:GetPlayerFromCharacter(p.Parent)
local level=plyr.level
level.Value=level.Value+1
local location=game.Workspace.Levelstarts:FindFirstChild("Level"..(level.Value))
p.Parent.Torso.CFrame = location.CFrame + Vector3.new(0,5,0)
Ting = 0
end
end)
end
return _M
test2 not being printed > Script inside of brick
local teleporter= require(game.Workspace.Teleporter)
teleporter.win()
I would like the script.Parent.Touched part be in the module script but if this is not possible then please tell me.
