I'm trying to make it so when the player scrolls up the values will go up by 1, but nothing happens.
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local num = script.Parent.Scrollnum.Value Mouse.WheelForward:connect(function() num = num +1 end) Mouse.WheelBackward:connect(function() end)
I ran into this problem when I was first learning how to script.
By saying the following, you're assigning 'num' a number, not the actually Scrollnum.
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local num = script.Parent.Scrollnum.Value Mouse.WheelForward:connect(function() num = num +1 end) Mouse.WheelBackward:connect(function() end)
Meaning,
num = script.Parent.Scrollnum.value
Is the exact same thing as
num = 5
This is a simple fix.
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local num = script.Parent.Scrollnum Mouse.WheelForward:connect(function() num.Value = num.Value +1 end) Mouse.WheelBackward:connect(function() end)
I don't know how to explain it any other way. Please thumb up if this helped.