Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with Model Transparency Command Script?

Asked by
iSvenDerp 233 Moderation Voter
8 years ago

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)
0
Why on line 2 do you define the 4 "Part"? :GetChildren() doesnt require anything but a location to get the children from. BinaryResolved 215 — 8y
0
I get what your saying but i also had a script in there so i could till do it and it wouldnt hurt anything right? iSvenDerp 233 — 8y

2 answers

Log in to vote
1
Answered by
ImageLabel 1541 Moderation Voter
8 years ago

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.

Ad
Log in to vote
2
Answered by 8 years ago

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
0
Hi..Thanks for helping and i think your right but it still doesnt work i got an error 09:45:39.187 - Workspace.Chamber.Script:28: unexpected symbol near ')' iSvenDerp 233 — 8y
0
he forgot an end. HungryJaffer 1246 — 8y
0
Derp sorry xD Prohibetur 70 — 8y
0
? so could u show me where? :3 i am just a poor little boy iSvenDerp 233 — 8y
View all comments (7 more)
0
On line 2 you checked if v is a basepart and never ended it. HungryJaffer 1246 — 8y
0
I know what I did ... also iSvenDerp replace just add an end after v.Transparency=0 Prohibetur 70 — 8y
0
I can't test it right I should he able to in a few hours iSvenDerp 233 — 8y
0
Still doesnt work:( 16:07:14.491 - Workspace.Chamber.Script:28: unexpected symbol near ')' iSvenDerp 233 — 8y
0
pairs( to next, ? since 'i' is not being used.. Nickoakz 231 — 8y
0
Sorry about that ... again ... If you copy and paste again it should work Prohibetur 70 — 8y
0
Thanks for the help iSvenDerp 233 — 8y

Answer this question