When encountering the documentation for mouse, there was a disclaimer as follows:
Mouse has been superseded by
ContextActionService, which cover a broader scope, are more feature rich, and support cross-platform patterns better. It remains supported because of its widespread use, but you should strongly consider using these alternatives.
I’d like to stay up to date with new features that the Wiki suggests, but how exactly am I able to get to the mouse and then to its target? I did trying following through, but the script gives me an error.
A basic test function where if you click a BasePart of sort, it will randomly change a color.
-- LocalScript inside StarterGui local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input,gameProcessed) if input.UserInputType == Enum.UserInputType.MouseButton1 then local target = input.Target if target:IsA("BasePart") then target.BrickColor = BrickColor.Random() end end end)
What am I doing wrong?