Also i still learning Scripts so i maybe mistake alot
Script:
local RandomDot = workspace.Part
local randomNumber = math.random(2,5)
math.random(2,5)
RandomDot.Transparency = 1
math.random(2,5)
RandomDot.Transparency = 0
Thank you Ya’ll
Also i still learning Scripts so i maybe mistake alot
Script:
local RandomDot = workspace.Part
local randomNumber = math.random(2,5)
math.random(2,5)
RandomDot.Transparency = 1
math.random(2,5)
RandomDot.Transparency = 0
Thank you Ya’ll
If you’re trying to make a part disappear and reappear at random:
local randomDot = workspace.Part
local randomTime = math.random(2,5)
task.wait(randomTime)
randomDot.Transparency = 1
--randomTime = math.random(2,5) <<< Uncomment this if you want to pick another random time
task.wait(randomTime)
randomDot.Transparency = 0
Do you mean like… making a random part in a group disappear? If so:
local RandomDot = “Your group here”
local GroupChilds = RandomDot:GetChildren()
local part = nil
part = GroupChilds[math.random(1,#GroupChilds)]
if part:IsA(“Part”) then
part.Transparency = 1
task.wait(1)
part.Transparency = 0
end
Just make sure that your Group isn’t blank, also sorry for not making it like in coding style bc I forgot how to
at line 1 do i need
local RandomDot = game.Workspace.RandomDot
if no need i will have red underline
with:
Without:
The “Your group here” was a example, you should replace it with your group, so if it is named RandomDot, it should be:
local RandomDot = workspace.RandomDot
Oh wait, and I almost forgot. Make sure to set the CanCollide to false if you want your part to be not collidable when invisible:
local RandomDot = “Your group here”
local GroupChilds = RandomDot:GetChildren()
local part = nil
part = GroupChilds[math.random(1,#GroupChilds)]
if part:IsA(“Part”) then
part.Transparency = 1
part.CanCollide = false
task.wait(1)
part.CanCollide = true
part.Transparency = 0
end
Oh yeah
local RandomDot = workspace.RandomDot
local GroupChilds = RandomDot:GetChildren()
local part = nil
part = GroupChilds[math.random(1,#GroupChilds)]
if part:IsA("Part") then
part.Transparency = 1
part.CanCollide = false
task.wait(1)
part.CanCollide = true
part.Transparency = 0
end
I was try screah “if part:IsA(“Part”) then” on Google cause it have redline and i little fix it
Can I see the code? Just to make sure you didn’t did anything wrong? Make sure the local in the first line should be:
local RandomDot = script.parent.Model.RandomDot
Local scripts (the ones with a blue color) do not run in the Workspace. Please try a Script (white-colored) instead.
Oh and ye, TolMLiker851 is right, but I guess you want it to be different for each player? if so, make sure the script is in the StarterPlayerScripts, and like this:
local RandomDot = workspace.Model.RandomDot (or your group)
local GroupChilds = RandomDot:GetChildren()
local part = nil
part = GroupChilds[math.random(1,#GroupChilds)]
if part:IsA(“Part”) then
part.Transparency = 1
part.CanCollide = false
task.wait(1)
part.CanCollide = true
part.Transparency = 0
end
it got error on line 1
RandomDot is not a valid member of Model "Workspace.Model.Model.RandomDot"
Can I see the list on the side? The one which shows you models, parts, folders, Services like workspace and etc? (I don’t know the name of it) Specifically the Group?
The Model of the Model of which the RandomDot is in doesn’t have a specific name, and the parent of that Model has more models called “Model”, that is why it doesn’t work, roblox instead just chooses the first one, you have to make a specific name for that Model to work
For an example, lets say you want to change the color of a part inside another part (gonna call it ppart, lpart for the part inside the another part), which is in the workspace with other parts with the same name, “Part”, since their name are all the same, roblox only chooses the first one because he doesn’t know what part is the ppart because they have all the same name, so if you want to do something with ppart you have to change the name to a different one for it to be unique, or else it will send a error saying that lpart isn’t a valid member of part
also i change “Model” into “ThePower”
and then i cnahe the first line is:
local RandomDot = script.parent.ThePower.RandomDot
Right?
Yep, another example which is way easier to understand: Lets say John punched John, but which John punched which John? You don’t know, just like roblox who doesn’t know which model is which model, because they all have the same name, so roblox just chooses the first one.
Also, you put “script.parent”, so I gonna assume it is a script, not a local script, just to remind you because like TolMLiker851 said, local scripts doesn’t run in the workspace
it still error
ThePower is not a valid member of Model "Workspace.ThePower.RandomDot"
i think i need script
local ThePower = somthing?
Yea i was Change into Script idk why i want Localscript before
Make sure the script is parented to the ThePower, not RandomDot.
Also, the model looks really good, keep on the great work!
Thank you i just want make Look like this on game Buckshot
also
the Script is:
local ThePower = script.parent.RandomDot
local GroupChilds = ThePower:GetChildren()
local part = nil
part = GroupChilds[math.random(1,#GroupChilds)]
if part:IsA("Part") then
part.Transparency = 1
part.CanCollide = false
task.wait(1)
part.CanCollide = true
part.Transparency = 0
end
right?, i think i do something wrong
Lemme check… And yea, should be all good, but you may want to switch it to:
local ThePower = script.parent.RandomDot
local GroupChilds = ThePower:GetChildren()
local part = nil
while task.wait(0.5) do
part = GroupChilds[math.random(1,#GroupChilds)]
if part:IsA("Part") then
coroutine.resume(coroutine.create(function()
part.Transparency = 1
part.CanCollide = false
task.wait(1)
part.CanCollide = true
part.Transparency = 0
end))
end
end
Since that way it would repeat endlessly and repeatedly, just like in the game.
“corountine.resume(corountine.create(funtion()” is for so it won’t overlap and have to wait 1.5 seconds, since roblox waits to then end