Hello guys, i need help in something I do not know how to do it.
local UserInputService = game:GetService("UserInputService")
local ModuleScript = require(game.ReplicatedStorage.Modules.ModuleScript)
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local KeyEnabled = false
local IsTarget = false
local Hass = 0
local function LoadingBarAction (LoadingBar, Bar)
UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.E then
KeyEnabled = true
LoadingBar.Visible = true
end
end)
UserInputService.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.E then
KeyEnabled = false
LoadingBar.Visible = false
Bar.Size = UDim2.new(0, 150, 0, 20)
Hass = 0
end
end)
game:GetService("RunService").Heartbeat:Connect(function(step)
wait(0.0)
if KeyEnabled then
if Hass >= 88 then
wait(0.5)
LoadingBar.Visible = false
return
end
Hass = Hass + 1
Bar.Size = UDim2.new(Bar.Size.Y.Scale + (Hass/90.5), 0, 0, 20) -- 0 + hass / 90.5
end
end)
end
while not IsTarget do
wait()
if Mouse.Target then
if Mouse.Target.Parent.Name == "Oro" then
Model = Mouse.Target.Parent.Oro
BillboardGui = Model.BillboardGui
LoadingBar = BillboardGui.Button.LoadingBar
IsTarget = true
LoadingBarAction(LoadingBar, LoadingBar.Bar)
end
end
end
in that script, what I do is that when the mouse is pointing to a block I can press the letter E, all right, it works correctly but how would it do if it is only currently looking at the block? that you can only do it if you are currently pointing to the block?
Thanks for reading!
