So, I was learnign gui's and decided to learn how to script a gui number increaser so when you click the arrow to the left it increases and the arror to the left and it decreases but it wont work
--this is the next button to increase value local Slide = script.Parent.Parent.Parent.Number -- declares local for Number function onClick() -- sets a click functiom if Slide.Value <=3 then -- sets a if and checks for vlaue of Number Slide.Value = Slide.Value +1 -- increases number by one end end script.Parent.Touched:connect(OnTouch)
~~~~~~~~~~~~~~~~~ -- this is a previous value ot decrease the number local Slide = script.Parent.Parent.Parent.Number -- declares a local for NumberRange
function onClick() if Slide.Value >= 2 then -- runs statement to check value of number Slide.Value = Slide.Value - 1 -- decreases value by one
end
end
script.Parent.Touched:connect(OnTouch) -- vconnects function to a click event
-- this is the number bar displaying script local Slide = script.Parent.Parent.Parent.Number -- declares locla for Number
while true do
if script.Parent.Text == Slide.Value then -- checks if value if equal to script parents value wait(1) end if script.Parent.Text ~= Slide.Value then -- checks if value is NOT equa. to parent value script.Parent.Text = Slide.Value end wait(1)
end
-- and the asset loading script to display images of numbers local Slide = script.Parent.Parent.Parent.Number -- dleclares local while true do if Slide.Value == 1 then script.Parent.Image = "http://www.roblox.com/asset/?id=90786317" end if Slide.Value == 2 then script.Parent.Image = "http://www.roblox.com/asset/?id=90786333" end if Slide.Value == 3 then script.Parent.Image = "http://www.roblox.com/asset/?id=90786341" end if Slide.Value == 4 then script.Parent.Image = "http://www.roblox.com/asset/?id=90786421" end wait(1) end
Hello the problem with ur script is
script.Parent.Touched:connect(OnTouch)
theirs no function named onTouch and ur using a button so it should be
script.Parent.MouseButton1Click:connect(OnClick)
if u need more help visit here http://wiki.roblox.com/index.php?title=API:Class/GuiButton/MouseButton1Click