Hello, I’m begginer scripter. So far, in StarterPlayerScripts, I disabled deflaut movement and wrote code that is mouse based
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent) --- Clicking Movement Code
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if mousetick == 0 then
RunService:BindToRenderStep("move",
-- run after the character
Enum.RenderPriority.Character.Value + 1,
function()
if localPlayer.Character then
local humanoid = localPlayer.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid:Move(Vector3.new(0, 0, _G.SpeedIncrease), true) --- Enable Movement
end
end
end
)
wait(BPM) --- Moving time
RunService:UnbindFromRenderStep("move") --- Disable movement
mousetick = 1 --- Wait to end movement to allow mousebutton2 for movement action
_G.SpeedIncrease = _G.SpeedIncrease - 0.2
elseif mousetick == 1 then
_G.SpeedIncrease = _G.SpeedIncrease + 0.1
end
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
if mousetick == 1 then
RunService:BindToRenderStep("move",
-- run after the character
Enum.RenderPriority.Character.Value + 1,
function()
if localPlayer.Character then
local humanoid = localPlayer.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid:Move(Vector3.new(0, 0, _G.SpeedIncrease), true) --- Enable movement after clicking
end
end
end
)
wait(BPM) --- running time after clicking, (per beat)
RunService:UnbindFromRenderStep("move") --- Disable movement After clicking
mousetick = 0
_G.SpeedIncrease = _G.SpeedIncrease - 0.2
elseif mousetick == 0 then
_G.SpeedIncrease = _G.SpeedIncrease + 0.1
end
end
end)
I want to make GUI bar that shows SpeedIncrease
Less SpeedIncrease = higher bar.
Bar doesn’t work, I thought it was a global variable issue, so i made a text label above. That shows SpeedIncrease with 1 second refreshing time
bar code (doesn’t work)
local object = script.Parent
object.AnchorPoint = Vector2.X(0)
local size = 0 - _G.SpeedIncrease
while true do
object.Size = UDim2.new(size, 0, 1, 0)
wait(0.5)
end
I’ve been dealing with this problem for too long. What went wrong?
Yes its my first project in roblox, and my first post on devforum, so far i made it with devforum posts and roblox tutorials it is great community.