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

OwnersOnlyDoor For Tycoon Should Work But Doesnt?

Asked by 9 years ago

So, I am using "Berezaa's Tycoon Kit" And i wanted to make a owners only door for my tycoon and all looks fine and dandy till I try it. I start up a server with 2 Players and buy the owners only door and it does not open or close any ideas on what i did wrong?

script.Parent.Kill.Touched:connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        script.Parent.Kill.CanCollide = false
        if script.Parent.Kill.Transparency == 0.5 then
            if player ~= script.Parent.Parent.Parent.Owner.Value then
                if hit.Parent:FindFirstChild("Torso") then
                    local expp = Instance.new("Explosion")
                    expp.BlastRadius = 3
                    expp.Position = hit.Position
                    expp.Parent = workspace
                    if hit.Parent:FindFirstChild("Humanoid") then
                        hit.Parent.Humanoid.Health = 0
                    end
                end
            end
        end
        wait(1)
        script.Parent.Kill.CanCollide = true
    end
end)


print("approved")
local owner = script.Parent.Parent.Owner.Value
local delay = 0.2
game.ReplicatedStorage.MasterKey:FireClient(owner,script.Parent.Green.ClickDetector,delay)
game.ReplicatedStorage.MasterKey:FireClient(owner,script.Parent.Red.ClickDetector,delay)

game.ReplicatedStorage.MasterKey.OnServerEvent:connect(function(player,mode,source)
    print("called")
    if player == owner and mode == "click" then
        if source == script.Parent.Green.ClickDetector then
            script.Parent.Kill.Transparency = 1
        elseif source == script.Parent.Red.ClickDetector then
            script.Parent.Kill.Transparency = 0.5
        end
    end
end)

OwnerDoor Parents: OwnerDoor.Purchases.Bright red* "Owner" ObjectValue is in Bright red

Anyone know where i messed up at? No error's in the output btw, Please help!

Answer this question