#touch event don't working
1 messages · Page 1 of 1 (latest)
local Module = {}
local function SwitchCollision(Boolean, Barriers: Folder)
for i, v in Barriers:GetChildren() do
if v.Name == "RealBarrier" then
v.CanCollide = Boolean
else
v.CanCollide = Boolean
v.Transoarency = (Boolean == true) and 0.5 or 1
end
end
end
function Module.SetupLocker(Plot: Model, LockerPart: Part, Barriers: Folder)
local Billboard = LockerPart.BillboardGui
local Status: TextLabel = Billboard.Status
local Timer: TextLabel = Billboard.Seconds
Billboard.Enabled = true
Status.Text = "UNLOCKED"
Timer.Text = ""
Status.Changed:Connect(function()
if Status.Text == "UNLOCKED" then
SwitchCollision(false)
else
SwitchCollision(true)
end
Status.Text = "UNLOCKED"
Timer.Text = ""
LockerPart.Touched:Connect(function(hit)
if hit.Parent.Name ~= Plot.Name then return end
if Status.Text == "UNLOCKED" then
Plot:SetAttribute("Locked", true)
Status.Text = "Locked"
spawn(function()
for i = 60, 1, -1 do
Timer.Text = i
task.wait(1)
end
Plot:SetAttribute("Locked", false)
Status.Text = "UNLOCKED"
Timer.Text = ""
end)
end
end)
end)
end
return Module
also, you have second argument, why you not calling it?
oh, im forgot, im change that to SwitchCollision(true, Barriers)
collision is working
try debugging to see where your script breaks
im change that
output dont have any errors
all works perfectly and script see lock part and change text
use print("")
in touch event?
up to you, you need to find where your script breaks
I would help find the error myself right now, but I just quickly looked at the script because I'm busy
ok, im go to game and try status change function, im change text to locked in properties, but barriers dont switch collision and dont print work text, mb mistake in this part of code?
** You are now Level 1! **
ohhh yeeah
im forgot end) after function and write end) after all script
thanks for help
np
well, when you will ask for help again send code like this
local bla = 40