I recently was making a throwing system with some dice. It works completely fine in Studio but upon further testing, it does not work outside of Studio.
For some particular reason, InputEnded does not fire Enum.UserInputType.MouseButton1 unless the mouse stops moving and releases. I’m not sure if this is some sort of bug or I’m doing something wrong, but it is quite annoying and I don’t know of any other way to achieve this. Keep in mind that this issue only happens when running on a live server.
Here’s some code(from my original post):
local camera = workspace.CurrentCamera
mouse.Icon = "rbxasset://textures/advClosed-hand.png"
DiceObject.Position = camera.CFrame.Position + (DiceObject.Position.Unit * 20)
UserInputService.InputBegan:Connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
Held = true
mouse.TargetFilter = DiceObject
mouse.Icon = "rbxasset://textures/advClosed-hand.png"
end
end)
UserInputService.InputEnded:Connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
Held = false
mouse.Icon = "rbxasset://textures/advCursor-openedHand.png"
if DiceObject then
if DiceObject:FindFirstChild("Gyro") or DiceObject:FindFirstChild("Force") then
DiceObject.Gyro:Destroy()
DiceObject.Force:Destroy()
end
end
end
end
game:GetService("RunService").RenderStepped:Connect(function()
if Held == true and DiceObject ~= nil then
DiceObject.Gyro.CFrame = DiceObject.CFrame
DiceObject.Force.Position = camera.CFrame.Position + (mouse.UnitRay.Direction * 20)
end
end)