I am making a building system and, am trying to make the actual placement.
This is not adjusted as i just made it to test but when i try to position the block to the Player’s mouse Target CFrame, it only returns Player
Here are the scripts:
module:
function module.place(block, mouse)
if mouse then
local clone = block:Clone()
print('cloned')
clone.Parent = workspace.BlocksPlaced
clone.Position = mouse.CFrame
clone.Name = "PlacedBlock"
end
end
local event = game.ReplicatedStorage.MouseDown
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
print'found'
event:FireServer(mouse.Target.CFrame)
end)
I hope someone can help, thanks for reading. All replies are Appreciated!
/edit
The error that i get is:
‘CFrame is not a valid member or Player (‘Players.KieranKreates’)’
function module.place(player, block, mouse)
if mouse.Target then
local clone = block:Clone()
print('cloned')
clone.Parent = workspace.BlocksPlaced
clone.Position = mouse.Target.CFrame
clone.Name = "PlacedBlock"
end
end
local event = game.ReplicatedStorage.MouseDown
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
print'found'
event:FireServer(player, mouse)
end)
function module.place(block, mouse)
if mouse.Target then
local clone = block:Clone()
print('cloned')
clone.Parent = workspace.BlocksPlaced
clone.Position = mouse.Target.CFrame
clone.Name = "PlacedBlock"
end
end
local event = game.ReplicatedStorage.MouseDown
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
print'found'
event:FireServer(mouse)
end)