Replicated Object's Script Doesn't Run

Hi everyone, this is my first post so I apologize if it isn’t concise. I’m trying to replicated an object into workspace from “ReplicatedStorage” with a script attached to it that’s simply supposed to print “Loaded” but for some reason it doesn’t run.

image

I’ve worked on a different game where I have achieved this with no issues. I am confused as to why this time, it’s not working.

Local Script:

local mouse = game.Players.LocalPlayer:GetMouse()
local ScreenSize = camera.ViewportSize
local MissilePrefab = game.ReplicatedStorage.Prefabs.Missile

mouse.Button1Down:Connect(function()
 	local UnitRay = camera:ScreenPointToRay(ScreenSize.X / 2, ScreenSize.Y / 2)
	local ray = workspace:Raycast(UnitRay.Origin, UnitRay.Direction * 1000)
	if ray then
		local missile = MissilePrefab:Clone()
		missile.Position = UnitRay.Origin
		missile.Parent = workspace
		missile:WaitForChild("RemoteEvent"):FireServer(ray.Position)
	end         
end)

the script:

print("Loaded")

I’m really not sure what to try to fix this, any and all pointers would be very helpful! Thank you!

Scripts and other LuaSourceContainers don’t run in ReplicatedStorage; you’ll have to change the parent to something else

Yes, that is why the missile object gets parented to workspace

I see the issue, you’re changing the parent client-sided, so the server won’t detect it, which is why it won’t run. You have to change the parent server-sided

Oh! Wow, I’ve been trying to figure this out for an hour thank you so much!