I don't know why my script doesn't work

Oh yes now it works completely without any errors yay thanks a lot

1 Like

char limit_________________________

1 Like

oh wait uh oh the script has a problem checking if the code is correct :sweat_smile:


when I type the correct code it doesn’t work ( I think I can fix this though if I have any problems i’ll make another reply)

I think it might just be a referencing problem or typo

i forgot to change back 1 thing maybe thats whats causing the prob

--script
local CodeValue = script.Parent.Parent.Parent.Parent.Parent.PC.Screen.Code

game.ReplicatedStorage.EnableKGUI.OnServerEvent:Connect(function(player,complete)
	local GUI = player.PlayerGui.KeycodeGUI
  GUI.Done.Value=complete
	if GUI.Done.Value == true then
		print("User has given a code")
		if GUI.Frame.Frame.CodeSee.Text == CodeValue.Value then
			print("CORRECT")
		else
			print("INCORRECT")
		end
	end
  end)

script.Parent.Prompt.Triggered:Connect(function(player)
	game.ReplicatedStorage.EnableKGUI:FireClient(player)
end)

--local
local KGUI = game.Players.LocalPlayer.PlayerGui.KeycodeGUI
local Chiffre = KGUI.Frame.Frame.CodeSee
local frame = script.Parent.Frame.Frame.Frame

game.ReplicatedStorage.EnableKGUI.OnClientEvent:Connect(function()
	KGUI.Enabled = true
	KGUI.Frame:TweenPosition(UDim2.new(0,0,0,0),"Out","Back",1,false)
end)

KGUI.Frame.X.MouseButton1Click:Connect(function()
    KGUI.Enabled = false
end)

for i ,key in pairs(frame:GetChildren()) do
	if string.find(key.Name, "Key") then
		key.MouseButton1Click:Connect(function()
			Chiffre.Text ..= string.match(key.Name, "%d")
		end)
	elseif key.Name == "Back" then
		key.MouseButton1Click:Connect(function()
			Chiffre.Text = string.sub(Chiffre.Text,1,0)
		end)
	elseif key.Name == "Enter" then
	    key.MouseButton1Click:Connect(function()
			script.Parent.Done.Value = true
        game.ReplicatedStorage.EnableKGUI:FireServer(script.Parent.Done.Value)
		end)
	end
end
1 Like

it still won’t know when the value is true oof rip :sweat_smile:

local CodeValue = script.Parent.Parent.Parent.Parent.Parent.PC.Screen.Code

game.ReplicatedStorage.EnableKGUI.OnServerEvent:Connect(function(player,complete,text)
	local GUI = player.PlayerGui.KeycodeGUI
  GUI.Done.Value=complete
  GUI.Frame.Frame.CodeSee.Text =text
	if GUI.Done.Value == true then
		print("User has given a code")
		if GUI.Frame.Frame.CodeSee.Text == CodeValue.Value then
			print("CORRECT")
		else
			print("INCORRECT")
		end
	end
  end)

script.Parent.Prompt.Triggered:Connect(function(player)
	game.ReplicatedStorage.EnableKGUI:FireClient(player)
end)

--local
local KGUI = game.Players.LocalPlayer.PlayerGui.KeycodeGUI
local Chiffre = KGUI.Frame.Frame.CodeSee
local frame = script.Parent.Frame.Frame.Frame

game.ReplicatedStorage.EnableKGUI.OnClientEvent:Connect(function()
	KGUI.Enabled = true
	KGUI.Frame:TweenPosition(UDim2.new(0,0,0,0),"Out","Back",1,false)
end)

KGUI.Frame.X.MouseButton1Click:Connect(function()
    KGUI.Enabled = false
end)

for i ,key in pairs(frame:GetChildren()) do
	if string.find(key.Name, "Key") then
		key.MouseButton1Click:Connect(function()
			Chiffre.Text ..= string.match(key.Name, "%d")
		end)
	elseif key.Name == "Back" then
		key.MouseButton1Click:Connect(function()
			Chiffre.Text = string.sub(Chiffre.Text,1,0)
		end)
	elseif key.Name == "Enter" then
	    key.MouseButton1Click:Connect(function()
			script.Parent.Done.Value = true
        game.ReplicatedStorage.EnableKGUI:FireServer(script.Parent.Done.Value,Chiffre.Text)
		end)
	end
end

soooo many edits :grinning_face_with_smiling_eyes:

1 Like

whelp it’s still not working oof :sweat_smile:

i am making something similar(char limit___________)

1 Like

OH I know the value is 0 for some reason

It has to wait for the code value to get a code and then use it

I checked the script and it seems that this is the problem:

1 Like

no worries i am making something similar
done ill upload the place
1 sec checking

2 Likes

you’re making a similar door code ??

oh okay

the same system charlimit________

1 Like

help.rbxl (38.2 KB)

1 Like

oh wow it works ! Oh also how do you inform to the player that it is incorrect ? I want to make this but I don’t really know how :sweat_smile: (should you make it on the server side or client side)

let me see(give me few sec) char_________

1 Like

okay! Thanks again for helping me :grinning:

replace code below with the print ‘incorrect’ statement

print("Incorrect")
keycode_Gui.Frame.TextBox.Text="Error" --first display error by cahnging the text
keycode_Gui.Frame.TextBox.TextEditable=false --Disable TextEditable property of textbox
wait(1)--wait a sec
keycode_Gui.Frame.TextBox.Text="" --change the text back to empty string
keycode_Gui.Frame.TextBox.TextEditable=true --Enable TextEditable property of textbox
1 Like

Thanks a lot! I gotta attend a zoom class so I have to go
i’m sending a reply to see everything working after class

1 Like

Actually wait i’m going to make another post since you fixed the initial problem but now I have another one, thanks

please post it seperately if i can ill reply whenever i can
it’s more efficient that way

1 Like