in a Script in ServerScriptStorage
It's supposed to fire to a client giving the name of the model so that the other script can clone the model from the name and place it.
local remotevents = game.ReplicatedStorage.RemoteEvents
local partplacer = remotevents.PartPlacer
partplacer.ShowPart.OnServerEvent:connect(function(plr,modelName)
partplacer.ShowPart:FireClient(modelName)
end);
This is the client |v|
local model = game.ReplicatedStorage.Model
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local PartPlacerModel = game.ReplicatedStorage.RemoteEvents.PartPlacer
local function updatePart(model)
model:SetPrimaryPartCFrame(CFrame.new(math.floor(mouse.Hit.p.X),0.5,math.floor(mouse.Hit.p.Z)))
end;
mouse.KeyDown:connect(function(key)
if key == "e" then
PartPlacerModel.ShowPart:FireServer(model.Name) -- Firing the ModelName
end;
end);
PartPlacerModel.ShowPart.OnClientEvent:connect(function(plr, modelName)
local model = game.ReplicatedStorage:FindFirstChild(tostring(modelName))
if model then
local newModel = model:Clone()
newModel.Parent = game.Workspace
mouse.Move:connect(function()
updatePart(newModel)
end);
end;
end);

1 comment
Script's cant run in ServerStorage (Or do you mean ServerScriptService?)