Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How I can open/cancollide part with LocalScript ?

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

2 comments

0

If you use “==1” then any other level value won’t work, you may want “>= 1”, unless that was your intention.

0

The more you look at the script, the funnier it gets

2 answers

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.

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

This discussion is preserved as it was. New answers, comments, and votes are closed.