Other players not seeing model movement in game

I have a spotlight model that I can control using WASD. But, when I got my alt account to join, there is no movement when I move it.

local userInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local SpotlightHead = game.Workspace.Spotlight1.Arm
local UpdateCon

userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if input.UserInputType ~= Enum.UserInputType.Keyboard then return end
	if input.KeyCode ~= Enum.KeyCode.A then return end

	if UpdateCon then
		UpdateCon:Disconnect()
		UpdateCon = nil
	end

	UpdateCon = RunService.Heartbeat:Connect(function(dt)
		local newCFrame = SpotlightHead.PrimaryPart.CFrame * CFrame.Angles(0, -0.05, 0)
		SpotlightHead:SetPrimaryPartCFrame(newCFrame)
	end)
end)

userInputService.InputEnded:Connect(function(input, gameProcessedEvent)
	if input.UserInputType ~= Enum.UserInputType.Keyboard then return end
	if input.KeyCode ~= Enum.KeyCode.A then return end
	if not UpdateCon then return end

	UpdateCon:Disconnect()
	UpdateCon = nil
end)

This is one of the 4 LocalScripts that are used to control the spotlight. (All 4 are in the StarterGui folder because they seem to only work there)

Is there any way to make it so every player is able to see the movement when I control it?

Any help is appreciated! :slight_smile:

This is because you are moving it client-sided, not server-sided, therefore no one else besides you can see it’s movements. Have the client fire a remote event to the server to change it.

Is it done on a local script as then it would not be replicated, use remote functions to fix this

I won’t be online any further from now.

I don’t have much knowledge of where to apply the remote event and function things, so if you want you can provide other information or examples.

I will check back tomorrow since I don’t have time anymore to fix the issues.

I am on my iPad so I can’t apply code but just search how to do it and watch the videos and send the vector 3 in the remote event. I will try to provide code tomorrow.

Client-Server replication issue, as has been suggested you need to handle the spotlight head’s movement on the server rather than on the client, that way its movement will replicate to each client as opposed to a single client. RemoteEvent objects are relatively simple to learn and use.

--CLIENT

local Game = game
local Workspace = workspace
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local ReplicatedStorage = Game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
local SpotlightHead = Workspace:WaitForChild("Spotlight1"):WaitForChild("Arm")
local UpdateConnection

UserInputService.InputBegan:Connect(function(InputObject, GameProcessed)
	if InputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end
	if InputObject.KeyCode ~= Enum.KeyCode.A then return end

	if UpdateConnection then
		UpdateConnection:Disconnect()
		UpdateConnection = nil
	end

	UpdateConnection = RunService.Heartbeat:Connect(function(Delta)
		local NewCFrame = SpotlightHead.PrimaryPart.CFrame * CFrame.Angles(0, -0.05, 0)
		RemoteEvent:FireServer(NewCFrame)
	end)
end)

UserInputService.InputEnded:Connect(function(InputObject, GameProcessed)
	if InputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end
	if InputObject.KeyCode ~= Enum.KeyCode.A then return end
	if not UpdateConnection then return end

	UpdateConnection:Disconnect()
	UpdateConnection = nil
end)
--SERVER

local Game = game
local Workspace = workspace
local ReplicatedStorage = Game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.RemoteEvent
local SpotlightHead = Workspace.Spotlight1.Arm

RemoteEvent.OnServerEvent:Connect(function(Player, NewCFrame)
	SpotlightHead:SetPrimaryPartCFrame(NewCFrame)
end)