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

Is there somthing wrong with this group only door script? [Not answered]

Asked by 10 years ago
----------------------------------------------------------------------
--Only Edit The Below-------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
GroupID = 1070877 --Change this to your groups ID
Door = script.Parent
Kill = false --If a player isnt in the group, then kill them on touch.
Teleport = false --Teleport Mode. Teleports to a certain position
X = 0 --For use with the Teleport Mode. Set to the X Position
Y = 0 --For use with the Teleport Mode. Set to the Y Position
Z = 0 --For use with the Teleport Mode. Set to the Z Position
----------------------------------------------------------------------
--Only Edit The Above-------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------

DB = false
script.Parent.Touched:connect(function(p)
if p.Parent:FindFirstChild("Humanoid") then
player = game.Players:GetPlayerFromCharacter(p.Parent)
if player then
if not DB then
DB = true
if player:IsInGroup(GroupID) then
if not Teleport then
Door.Transparency = 1
Door.CanCollide = false
wait(0.4)
Door.Transparency = 1
Door.CanCollide = true
DB = false
elseif Teleport then
player.Character.Torso.CFrame = CFrame.new(X,Y+2,Z)
DB = false
end
elseif not player:IsInGroup(GroupID) then
if Kill then
p.Parent.Humanoid.Health = 0
DB = false
elseif not Kill then
DB = false
end
end
end
end
end
end)

It keep glitching after somone walks through it a couple times, thus, they can't walk through it anymore.

0
Can't* BrendonWalker -2 — 10y
0
Disregard this comment /\ BrendonWalker -2 — 10y
0
What is the error when it glitches, or what is happening when it glitches? xDeathBear 90 — 10y
0
After walking through it a few times, it just stops working. BrendonWalker -2 — 10y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I noticed that it has a lot of unnecessary stuff since I see 2 values are false.

GroupId = 1070877

script.Parent.Touched:connect(function(hit)
    if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
        p = game.Players:GetPlayerFromCharacter(hit.Parent)
        if p:IsInGroup(GroupId) then
            script.Parent.CanCollide = false
            script.Parent.Transparency = 0.7
            wait(0.4)
            script.Parent.CanCollide = true
            script.Parent.Transparency = 0
        end
    end
end)
0
So where should I put this in the script? Or, is that the whole script I need? BrendonWalker -2 — 10y
Ad

Answer this question