Hello, today I have a problem with creating my block placing tool, first, I have a tool that I click to activate and my mouse is hovered over an existing part, and then it sends a remote event fire over to the server to place the block at my cursors position. But instead it’s placing it on the middle of my world.
I am getting this error:
Hit is not a valid member of UnionOperation "Workspace.Grass"
localscript:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("DirtPlaceOnServer")
script.Parent.Activated:Connect(function()
remote:FireServer(mouse.Target)
end)
Server script:
local remoteevent = game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("DirtPlaceOnServer")
local dirt = game.ServerStorage:WaitForChild("Blocks"):WaitForChild("Dirt")
remoteevent.OnServerEvent:Connect(function(player,obj)
local dirtclone = dirt:Clone()
dirtclone.Parent = workspace
dirtclone.Position = Vector3.new(math.floor(obj.Hit.Z),math.floor(obj.Hit.Y),math.floor(obj.Hit.Z))
end)
I’m not sure how to solve this.