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

Group SurfaceGUI button sliding door not working?

Asked by 6 years ago

So in green, I will label what I think should be happening at points.

local TweenService = game:GetService("TweenService") -- Localisations
local door1 = script.Parent:WaitForChild("Door1")
local door2 = script.Parent:WaitForChild("Door2")
local tweeningInformation = TweenInfo.new( -- Tweening
    0.5,
    Enum.EasingStyle.Back,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)
local door1Open = {CFrame = CFrame.new(-34.713, 4.64, 77.222)} -- Tween to locations
local door2Open = {CFrame = CFrame.new(-43.063, 4.64, 77.222)}
local door1Close = {CFrame = CFrame.new(-37.513, 4.64, 77.222)}
local door2Close = {CFrame = CFrame.new(-40.262, 4.64, 77.222)}
local tween1open = TweenService:Create(door1,tweeningInformation,door1Open) -- Tween localisations
local tween1close = TweenService:Create(door1,tweeningInformation,door1Close)
local tween2open = TweenService:Create(door2,tweeningInformation,door2Open)
local tween2close = TweenService:Create(door2,tweeningInformation,door2Close)

game.Players.PlayerAdded:connect(function(Player) -- Detects player
    script.Parent.Monitor.Screen.Frame.Open.MouseButton1Click:connect(function() -- Finds open/close surfaceGUI buttons
        if Player:GetRankInGroup(3240451) == 255 then -- Checks if user is in group with ID
            tween1open:Play() -- Opens door
            tween2open:Play()
        else
            print("Player not sufficient rank") -- If player isn't in group, print no
        end
    end)
end)

game.Players.PlayerAdded:connect(function(Player)
    script.Parent.Monitor.Screen.Frame.Close.MouseButton1Click:connect(function()
        if Player:GetRankInGroup(3240451) == 255 then
            tween1open:Play()
            tween2open:Play()
        else
            print("Player not sufficient rank")
        end
    end)
end)

But it isn't working. The buttons are on a surface GUI. Basically what it is, is when someone of a specific rank in my group walks into a room, they find a little computer with a close/open button on for the sliding door. Only members of they're rank and group can use it, then it checks if they clicked the button. IF all that has gone through successfully, it should open the doors but it won't? This is the model spread out; http://prntscr.com/g8wxx3.

If anyone finds the problem can you shoot it to me? Thanks!

Answer this question