Let me explain that better. Basically, I have a part, and when the player touches it, it will fire a remote event that runs some client-side code.
The server script (below) works fine when the object is a child of the workspace from the start. However, if I try to change the parent of the crate via scripting (i.e move the crate from ReplicatedStorage to Workspace) the script suddenly does nothing. Can anyone help?
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = workspace[hit.Parent.Name]
local player = game.Players:GetPlayerFromCharacter(plr)
game.ReplicatedStorage.CoinChestEvent:FireClient(player)
script.Parent.Parent:Destroy()
end
end)

2 comments
Server scripts only run when descendants of workspace, serverscriptservice and backpack. So you'll need another script to do this. -@/9 why are you indexing the player from the workspace?
Change it to 'local plr = hit.Parent.Name' on line 3 instead of adding that workspace.