Property changing issue

I’m working on a project right now and it involves spleef parts, I want it to fade slowly into being fully transparent however the way ive done it is where it slowly fades after being touched by a player but its really buggy if the player doesnt instantly move off the part

Mind showing us your code? That would help.

spleef = script.Parent
spleef.Touched:Connect(function(hit)
wait (wait time)

and then change the property of the part, its fully working its just the transparency fading which isn’t.

Please show us the whole thing, so we could understand better

thats it, the rest is just transparency = 0.8 / 0.6 / 0.4 / 0.2 / 0 / cancollide = false

I believe this is what you are attempting to create:

local spleefParts = [The folder or model of where ever your “spleef parts” are located]

for i, part in pairs(spleefParts) do
      local deBounce = false
      part.Touched:Connect(function(hit)
           local player = game:GetService(“Players”):GetPlayerFromCharcter(hit)
           if (player and deBounce == false) then 
                   deBounce = true
                   While part.Transparency > 0 do
                   part.Transparency -= 0.1
                   task.wait(0.1)
           end
    end
deBounce = false
      end)
end

From what I have seen of your code, if the player walks over the part, it’ll constantly attempt to fade the part.

I apologize for my indenting, I am currently on a phone, which makes indenting difficult.

change this line to part.Transparency += -0.1
or use TweenService

edit: i thought i was replying to post owner

I have never seen it done like this before. Why should I do it like that. Yeah I guess you could tween it, but phone… Too much to type.

1 Like

What you’ll want to use is a .Touched connection so when the part is touched, it activates a function and then disconnect the .Touched connection or add a cooldown variable.

Then you can create a Tween with TweenService:Create(instance, tweenInfo, {propertyTable}) to tween the touched part’s transparency.

Now you want to use a TweenBase:Completed() connection to wait until the transparency Tween is finished, and once it is finished, you can change the part’s CanCollide Property to false and disconnect the connection.