I have had this problem for a while and I am still trying to fix it.
The bool value changes, but when the bool value changes and the player touches it, it doesn’t work at all.
Everything is already defined!you just cant see it
local CollectionService = game:GetService("CollectionService")
local TS = game:GetService("TweenService")
local fadetime = 1.5
local info = TweenInfo.new(fadetime, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local function fadePart(part)
part.Touched:Connect(function(hit)
local fade = TS:Create(part, info, {Transparency = 1})
fade:Play()
wait(fadetime)
part.CanCollide = false
end)
end
for _, part in CollectionService:GetTagged("Spleefs") do
if spleefAllow == true then
fadePart(part)
end
end
I fail to see what the BoolValue you are referring to. Regardless, it may be due to the fact that your GetTagged method is firing before the parts are actually tagged. Consider this pattern instead:
local function onSpleefPartAdded(instance)
if spleefAllow == true then
fadePart(instance)
end
end
CollectionService:GetInstanceAddedSignal:Connect(onSpleefPartAdded)
for _, part in CollectionService:GetTagged("Spleefs") do
task.spawn(onSpleefPartAdded, part)
end