Little confused here on why it thinks it is a player…
Error: " Parent of Player can not be changed" (Coming from the server)
Localscript:
script.Parent.Activated:Connect(function()
if Equipped then
if PartPreview.PrimaryPart then
local PartPlacement = game.ReplicatedStorage.Models:WaitForChild(Settings.PartModel):Clone()
--PartPlacement.Parent = workspace
local PartPreviewCFrame = PartPreview.PrimaryPart.CFrame
PlaceRemote:FireServer(PartPlacement, PartPreviewCFrame)
--PartPlacement:SetPrimaryPartCFrame(PartPreview.PrimaryPart.CFrame)
end
end
end)
-- Server Script Service
ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlaceRemote = ReplicatedStorage.Models.PlaceRemote
PlaceRemote.OnServerEvent:Connect(function(PartPlacement, PartPreviewCFrame)
PartPlacement.Parent = workspace
PartPlacement:SetPrimaryPartCFrame(PartPreviewCFrame)
end)
The first parameter on a server event is the player, always.
change PlaceRemote.OnServerEvent:Connect(function(PartPlacement, PartPreviewCFrame) to PlaceRemote.OnServerEvent:Connect(function(Player, PartPlacement, PartPreviewCFrame)
Players = game:GetService("Players")
ReplicatedStorage = game:GetService("ReplicatedStorage")
local module = ReplicatedStorage:FindFirstChild("PlacementSettings")
local Settings = require(module)
local player = Players.LocalPlayer
local character = workspace:FindFirstChild(player.Name)
local mouse = player:GetMouse()
local Equipped = false
local isRotating = false
local PlaceRemote = ReplicatedStorage.Models.PlaceRemote
script.Parent.Equipped:Connect(function()
if not Equipped then
Equipped = true
local PartPreview = game.ReplicatedStorage.ModelPreview:WaitForChild(Settings.ModelPreview):Clone()
PartPreview.Parent = workspace
mouse.TargetFilter = PartPreview
mouse.Move:Connect(function()
local posX,posY,posZ = mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z
PartPreview:MoveTo(Vector3.new(posX,posY,posZ))
end)
script.Parent.Activated:Connect(function()
if Equipped then
if PartPreview.PrimaryPart then
local PartPlacement = game.ReplicatedStorage.Models:WaitForChild(Settings.PartModel):Clone()
--PartPlacement.Parent = workspace
local PartPreviewCFrame = PartPreview.PrimaryPart.CFrame
PlaceRemote:FireServer(PartPlacement, PartPreviewCFrame)
--PartPlacement:SetPrimaryPartCFrame(PartPreview.PrimaryPart.CFrame)
end
end
end)
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(inputObject, gameProcessEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
if not isRotating and Equipped then
print("Holding R")
isRotating = true
while isRotating do
PartPreview:SetPrimaryPartCFrame(PartPreview.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(5), 0))
wait(0.1)
end
end
end
end)
uis.InputEnded:Connect(function(inputObject, gameProcessEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
if isRotating then
print("Stop")
isRotating = false
end
end
end)
script.Parent.Unequipped:Connect(function()
if Equipped then
Equipped = false
PartPreview:Destroy()
end
end)
end
end)
This means it’s not getting the PartPlacement variable. You didn’t try to send the player from the client did you? Also, game.ReplicatedStorage.Models:WaitForChild(Settings.PartModel) looks odd. The thing inside WaitForChild has to be a string that is the name of the instance. Is this the case?
Sorry for the late response I’m pretty busy.