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

For some reason whenever I check the players doorsopened value it says wayy more than 1??

local door = game.Workspace.Door1
local surfacegui = door.SurfaceGui.TextLabel
local plr = game.Players.LocalPlayer
door.Touched:Connect(function(touch)
	if touch.Parent:FindFirstChild("Humanoid") then
		if plr.leaderstats.Throws.Value <= 99 then
			print("Player Does Not Have Enough")
			door.Transparency = 0.5
			door.CanCollide = true
			surfacegui.Visible = true
		else
			if plr.leaderstats.Throws.Value >= 99 then
				plr.doors.DoorsOpened.Value = plr.doors.DoorsOpened.Value +1
				if plr.doors.DoorsOpened.Value == 1 then
						door.Transparency = 1
				door.CanCollide = false
						surfacegui.Visible = false
						end
					end
				end
			end
		end)

Idk why? Maybe i need a debounce for it to make it wait like a LOT?

1 answer

This script doesn't have any debounces, therefore it is expectable to be more than one.

local door = game.Workspace.Door1
local surfacegui = door.SurfaceGui.TextLabel
local plr = game.Players.LocalPlayer
door.Touched:Connect(function(touch)
    if touch.Parent:FindFirstChild("Humanoid") then
        if plr.leaderstats.Throws.Value < 99 then
            print("Player Does Not Have Enough")
            door.Transparency = 0.5
            door.CanCollide = true
            surfacegui.Visible = true
        else
            if plr.leaderstats.Throws.Value >= 99 and not plr:FindFirstChild("doorOpened") then
		local d = Instance.new("IntValue")--doesn't really matter if its a intvalue or not
		d.Name = "doorOpened" --names it so the script knows the player has already passed thru
		d.Parent = plr
                plr.doors.DoorsOpened.Value = plr.doors.DoorsOpened.Value +1
                if plr.doors.DoorsOpened.Value == 1 then
                        door.Transparency = 1
                door.CanCollide = false
                        surfacegui.Visible = false
                        end
                    end
                end
            end
        end)

2 comments

0

do you know how to make it where you lose 100 Throws value?

0

Throws.Value = (Throws.Value - 100) ?

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