so i have made a script that fire an event based on a leaderstat and the number entered, but this does not work and i cannot figure out why since there is no errors
local function dropping(Resource)
if not button.Parent.TextBox == nil then
local number = button.Parent.TextBox.Text
if tonumber(number) <= tonumber(Resource) then
print("yesss")
--drop:FireServer("Wood", number)
elseif tonumber(number) >= tonumber(Resource) then
button.TextColor3 = Color3.new(0.985946, 0, 0.0406043)
button.Text = "INVAILD NUMBER"
wait(2)
button.TextColor3 = Color3.new(255,255,255)
button.Text = "Drop"
end
end
end
button.MouseButton1Click:Connect(function()
if Text == "Dropping: Wood" then
dropping(player.Resources.Wood.Value)
end
end)
Have you tried debugging? Try to print out some values and see what returns
Example, try to print those:
print(number)
print(Resource)
print(button.Text)
Try to print them at any step in your code to see what returns to you, and see if there are any errors.
Also,
1.Use task.wait instead of wait.
2.tonumber(Resource) no need to do that, since Resource represents an intvalue / numbervalue [ hope so], it is already a number.