I will usually get the players mouse by doing game.players.localplayer:Getmouse()
What would that look like in a script
I have never used os time sorry so i dont know what to do
Something like this, but this is clientSided and would need that serverSide to handle it or at least to do sanity checks, meanwhile, this shows a basic approach on how it should work
local userInputService = game:GetService("UserInputService")
local StartTime
local HoldTime
local function onMouseButton1Click()
print("Mouse button started")
StartTime = os.time()
end
local function onMouseButton1Release()
print("Mouse button released")
HoldTime = os.time() - StartTime
warn("Player holded the mouse button for:", HoldTime, "secs")
end
userInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
onMouseButton1Click()
end
end)
userInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
onMouseButton1Release()
end
end)
If i use ticks would it go into the decimals
Thank you it works how i like it
Yes it does go into decimals if any one was wondering
I figured that ticks are better than making football power than using a value as power
in the case of camera instances that do not interact with physics and the real world, is it better to use os.time() or os.clock() as tick?
I mean the movement of a viewmodel.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.