Hi..(Thanks for any help in advance) I am making a command script for my group and i already have most of the commands done but this one isnt working. when i say open this model with 4 parts becomes Visible. I already tried it with a part and it worked but i transferred the script to the model and now its not working. Output shows nothing but I think whats messing up something is when I call the model. I dont think its the chatted part or the admin part because it worked when it was a part and like ive said ive already made other commands. Here it is...
local Admins = {"iSvenDerp"} P = script.Parent:GetChildren("Part","Part","Part","Part") function checkAuthority(name) for a,v in pairs(Admins) do if v == name then return true end end return false end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if msg == "open" or msg == "Open" and checkAuthority(player.Name) then P.CanCollide = true P.Transparency = 0 end end) end) game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if msg == "close" or msg == "Close" and checkAuthority(player.Name) then P.CanCollide = false P.Transparency = 1 end end) end)
Your blocks aren't anchored, which explains why they fall down, and are eventually destroyed. You wouldn't see the process because you're setting the transparency property of the parts to 1.
There's two things wrong. First, your table P. With :GetChildren()
it doesn't need any arguments meaning you should replace script.Parent:GetChildren("Part","Part","Part","Part")
with script.Parent:GetChildren()
Second, it looks like you're trying to make the table transparent and Non-Collidable, not the actual parts. One way of fixing this would be to replace
P.CanCollide = true P.Transparency = 0
with
for i, v in pairs (P) do--Loops through the children of `script.Parent` if v:IsA("BasePart") then--Makes sure that the object is a part v.CanCollide=true v.Transparency=0 end end
And do the same with
P.CanCollide = false P.Transparency = 1