I'm making a game where if you have a color selected you can click a brick and it changes it to that color. It works fine, but the mouse.target script is a local script. Is it possible to make it a regular script?
If you meant by "regular script" a global script then: to use Mouse.Target in a global script, use a remote event to connect between the local script that will fire the :FireServer() on the remote event and the global script that will use the remote event's OnServerEvent, then you could pass the Mouse.Target variable (game.Players.LocalPlayer:GetMouse().Target) that you will make in the local script from the local script to the global one. You will have to do this because you can't use Mouse(game.Players.LocalPlayer:GetMouse()) in global scripts, but you can pass the mouse's target aslong as you use remote events. https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
Hello, barrettr500!
Welcome to the ClickDetector
tutorial. A ClickDetector is an object which allows for a part to be clicked. They are server-side only, so you can use this instead of a mouse’s Target
property. The ClickDetector.MouseClick
event is the event that captures the mouse click on its BasePart
parent.
--Server script inside of a part local part = script.Parent local clickDetector = Instance.new("ClickDetector", part) clickDetector.MouseClick:Connect(function(plr) -- player passed print(plr.Name) --do your brick color changing code here end)