so, i am making a building game and in my local script the choosen block do not move to the cursor’s hit
i tried to seek for solutions in forum but it seems that there is not too much forums about that and unsolved forums
i made the script to print the block’s position and it prints the exact hit of my cursor
i also tried to change the block’s position by the mouse hit by using mouse hit olny without BlockPOS instead
the local script:
local EventsFolder = script.Parent.Parent.Events.BuildingEvents
local BlockChoosen = EventsFolder.BlockChoosen
local PlaceBlock = EventsFolder.PlaceBlock
local Tool = EventsFolder.Parent.Parent
local BlockPOS = Vector3.new(0,0,0)
local BlockROT = Vector3.new(0,0,0)
local Block = nil
BlockChoosen.Event:Connect(function(BlockChoosen)
Block = BlockChoosen:Clone()
BlockChoosen.Parent = workspace.BlockPreviewArea
end)
game.Players.LocalPlayer:GetMouse().Move:Connect(function()
BlockPOS = game.Players.LocalPlayer:GetMouse().Hit.Position
if Block == nil then else
Block.Position = BlockPOS
end
end)
Tool.Unequipped:Connect(function()
if Block == nil then else
Block:Destroy()
Block = nil
end
end)
game.Players.LocalPlayer:GetMouse().Button1Up:Connect(function()
if Block == nil then else
PlaceBlock:FireServer(BlockPOS, BlockROT, BlockChoosen)
end
end)