Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Information not replicated across roblox's server/client boundaries?

mouse.Target isn't replicated across the server/client boundary so I can't for example, make it so that a specific model that I am pointing at becomes a color when you click it (by using a remote function)

is there any way to go around this?

1 comment

0

You CAN make it so that when you click on a model, all of its parts become a specific color(by using a RemoteFunction/RemoteEvent).

1 answer

✓ Accepted answer

You can do this using remote events:

The normal script inside ServerScriptService:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ColorEvent = ReplicatedStorage:WaitForChild("ColorEvent")

ColorEvent.OnServerEvent:Connect(function(Player,Target)
	if Target then
		Target.BrickColor = BrickColor.new("Really red")
	end
end)

The local script inside PlayerGui:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ColorEvent = ReplicatedStorage:WaitForChild("ColorEvent")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.Button1Down:Connect(function()
	if Mouse.Target and Mouse.Target.Parent then
		local Target = Mouse.Target
		ColorEvent:FireServer(Target)
	end
end)

And create an event called ColorEvent inside ReplicatedStorage

This discussion is preserved as it was. New answers, comments, and votes are closed.