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

How I can open/cancollide part with LocalScript ?

Asked by 4 years ago
Edited 4 years ago

Idk how leaderstats can open the door

wait(2)
local part = Instance.new("Part",game.Workspace.Camera)
if game.Players.LocalPlayer.leaderstats.Lvl.Value == 1 then
    part.CanCollide = false
    part.Transparency = 1
end
0
If you use “==1” then any other level value won’t work, you may want “>= 1”, unless that was your intention. ABK2017 406 — 4y
0
The more you look at the script, the funnier it gets sahadeed 87 — 4y

2 answers

Log in to vote
0
Answered by
Miniller 562 Moderation Voter
4 years ago

So.. What's the problem? You know this question can be closed for several reasons, right? First of all, how is this part an actual door? You just create a new part to.. workspace.Camera.. ?? How is this a door? If you create this with a script then you would have to set the size, all the decorations and stuff. You may want to pre create the part and then use local part = workspace.Part --I mean, just refer to that part after the equation sign. And now it should work? If the check is ok and it returns true then it should work.

Ad
Log in to vote
0
Answered by 4 years ago

The part is required to be anchored. When you put a part into the workspace, then uncancollide it, it will fall into the ground. Make sure you set the size and position of the part to your preferences for it to look like a door. Or, and easier way you can do this is to clone a part from replicated storage that is positioned and scaled how you like it.

The part is also not able to be inside the camera. The part will not be able to exist inside of camera. Make sure you put the part into workspace instead.

Fixed Script:

wait(2)
local part = Instance.new("Part",game.Workspace)
part.Anchored = true
part.Position = Vector3.new([[--put the position you prefer here--]])
part.Size = Vector3.new([[--put the size you prefer here--]])

if game.Players.LocalPlayer.leaderstats.Lvl.Value == 1 then
    part.CanCollide = false
    part.Transparency = 1
end

Answer this question