As far as I’m aware, you can’t.
Parts created from localscripts are not synced with the server, so clickDetectors don’t work on them.
You’ll have to launch a remoteEvent when creating the part, then create it on the server
This should be on the server, I’d guess something around these lines.
local event = game.ReplicatedStorage.ClickEvent
script.Parent.MouseButton1Click:Connect(function()
event:FireServer(player)
end)
-- Server Script
local event = game.ReplicatedStorage.ClickEvent
event.OnServerEvent:Connect(function(player)
local prie = game.ReplicatedStorage.reint:Clone()
prie.Parent = game.Workspace
prie.Position = game.Workspace.reint.Position + Vector3.new(0,9,0)
-- optional but possible
prie:SetNetworkOwner(player)
end)
I have thought if something, Create the part on the server, then do FireAllClients(), then in the localscript that retrieves the event, simply check if the localplayer is the NetworkOwner, if not, set CanCollide to false and Transparency to 1
(Check for the network ownership on the server)
To do a “MouseHoverEnter” event on a part cloned by a localscript, you can simply add the “MouseHoverEnter” event to the cloned part within the cloning function.
function nirand()
local prie = game.ReplicatedStorage.reint:Clone()
prie.Parent = game.Workspace
prie.Position = game.Workspace.reint.Position + Vector3.new(0,9,0)
-- Add MouseHoverEnter event to cloned part
prie.MouseHoverEnter:Connect(denis)
end
script.Parent.MouseButton1Click:Connect(nirand)```