What do you want to achieve? Keep it simple and clear!
So basically i’m making an gang system and gang name shouldn’t be more than 16 char. i’m using string.len to get amount of characters, and for some reason it always says what “Gang name should be less than 16 char.” even if it 2 chars. Idk what is the problem
What is the issue? Include screenshots / videos if possible! Described in 1.
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I was searching on Dev Forum and found few topics, and it should work idk what is problem.
Code:
local LCS = script.Parent.Parent.Parent.LCscreen
local GangParametersGUI = script.Parent.Parent.Parent.GangParameters
local Button = script.Parent
local GangCEvent = game.Workspace.GangsEvents.GangCEvent
local GangNameBox = GangParametersGUI.GangNameBox
local GangNameText= GangNameBox.Text
local GangNameLen = string.len(GangNameText)
print(GangNameLen)
local GangTypeVal = script.Parent.Parent.TextLabel.GangType
Button.MouseButton1Click:Connect(function()
if GangNameLen < 16 then
GangCEvent:FireServer(GangNameBox.Text, GangTypeVal.Value)
GangParametersGUI.Visible = false
LCS.Visible = true
else
Button.Text = "Gang Name Should be less than 16 char."
wait(3)
Button.Text = "Create Gang!"
end
end)
Well instead of getting string from textbox now i get it from other script inside of textbox, here is it:
local Box = script.Parent
local GangNameVal = script.Parent:FindFirstChild("GangName")
Box.FocusLost:Connect(function()
GangNameVal.Value = Box.Text
end)
Now i get string from value.
Also new code:
local LCS = script.Parent.Parent.Parent.LCscreen
local GangParametersGUI = script.Parent.Parent.Parent.GangParameters
local Button = script.Parent
local GangCEvent = game.Workspace.GangsEvents.GangCEvent
local GangNameBox = GangParametersGUI.GangNameBox.GangName
print(GangNameBox.Value)
local GangNameText= GangNameBox.Value
local GangNameLen = string.len(GangNameText)
print(GangNameLen)
local GangTypeVal = script.Parent.Parent.TextLabel.GangType
Button.MouseButton1Click:Connect(function()
if GangNameLen < 16 then
GangCEvent:FireServer(GangNameText, GangTypeVal.Value)
GangParametersGUI.Visible = false
LCS.Visible = true
else
Button.Text = "Gang Name Should be less than 16 char."
wait(3)
Button.Text = "Create Gang!"
end
end)
Well anyways this don’t work, it still go to next page if char >16. Also here is prints:
Other print which string.len is just don’t print bruh