im currently making a fridge that when u are inside with the door closed a freezing gui fades in and fades out when u get out
issue is that the collide event only apparently works when the player moves and when it stands still it stops
ive tried searching for it but i found nothing somehow
this is what happens
this is the client side code for it
wait(1)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local guiObjects = {}
local partToCollideWith = workspace.Fridge.ez
local fadeSpeedIn = 0.05
local fadeSpeedOut = 0.05
local maxTransparency = 0
for i = 1, 10 do
table.insert(guiObjects, player.PlayerGui.frost:WaitForChild("overlay" .. i))
end
local function changeTransparency(value)
for _, guiObject in pairs(guiObjects) do
guiObject.ImageTransparency = value
end
end
local function onTouch(hit)
if hit.Parent == character then
print("yes")
for transparency = 1, maxTransparency, -fadeSpeedIn do
if partToCollideWith.Parent.Partez.Value.Value == false then
changeTransparency(transparency)
wait(0.05)
print("YES")
end
end
end
end
local function onTouchEnded(hit)
if hit.Parent == character then
while guiObjects[1].ImageTransparency < 1 do
for _, guiObject in pairs(guiObjects) do
guiObject.ImageTransparency = guiObject.ImageTransparency + fadeSpeedOut
end
wait(0.05)
end
end
end
partToCollideWith.Touched:Connect(onTouch)
partToCollideWith.TouchEnded:Connect(onTouchEnded)
this is my first ever post so sry if im bad at it