What's Wrong With my Script?

So. I was trying to make a script where the block appears and then disappears. I tried a while true do loop, but it never worked. Am I doin something wrong?
As always, Thanks,
ParkCityUSA

I put variables in the loop. Did that do anything?

Could you copy and paste the code into here? And use the three ``` on each side of your code to format your code.

Any kind of loop could work… depends on what specific behaviour you desire, you are not showing the script btw :v

just access the Part and its property Transparency = 1 for invisible or Transparency = 0 for being visible. From 0 to 1, like 0.5

Yeah, still abit new to DevForum.

Yeah, I tried that. It didn’t work.

Yeah, as @MJTFreeTime was saying, please provide us with the script so we may help you.

1 Like

No. The computer I’m on right now is a different computer from the one I use for Roblox Studio.

please type the code so we can see it

Code please :+1: would be much help

Well in that case, perhaps you should wait till you’re on the computer you use for Roblox Studio. It’s impossible to help when we have no clue of the code at hand. And also, if one of us did somehow provide a solution, we wouldn’t know that until you tested the code on you other computer anyways!

So don’t get me wrong, I’m here to help. But how would someone fix a problem that they can’t see or have details on?

1 Like

‘’'Lua
while true do
local ParentTransparency = script.Parent.Transparency
local ParentCanCollide = script.Parent.CanCollide
ParentTransparency = 0.50
ParentCanCollide = true
wait(2)
ParentTransparency = 0
wait(3)
end

1 Like

A good excercise could be, why dont you try to create a code from zero in here?

Here’s something that I threw together for ya.

--This script is placed inside of the part.

while true do
	script.Parent.Transparency = 0.75
	script.Parent.CanCollide = false
	wait(1)
	script.Parent.Transparency = 0
	script.Parent.CanCollide = true
	wait(1)
end

I hope this helps.

Also, here’s a video I took of the result:
4d96e7c2dd316282192437bb188b1502
You may see it do a faster blink at some point but that’s just the GIF starting over.

1 Like

Ok. I’ll try that. If you come up with a solution, tell me!

I believe it’s not doing anything because you’re setting the variable, ParentTransparency, to equal the value of script.Parent.Transparency. Then when you change the variable, it changes the value stored in the variable, not in the actual .Transparency property of the part.

1 Like

Also, this should work:

while true do
    script.Parent.Transparency = 0.50
    script.Parent.CanCollide = true
    wait(2)
    script.Parent.Transparency = 0
    wait(3)
end

EDIT: Please give the solution to @99guineafowl if this works, as he originally posted working code nearly the exact same as this.

2 Likes