Please Help me fix this, ive been trying to fix this in 6-7 Hours
`local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local mouse = player:GetMouse() local camera = workspace.CurrentCamera
local mouseRay = mouse.UnitRay
local block = game.ReplicatedStorage.PlacementBlocksClientSide.StoneClient:Clone()
local runService = game:GetService("RunService") local uis = game:GetService("UserInputService")
local pframe = script.Parent.PlacementFrame local stoneButton = pframe.Stone
local function placement(X, Y) local params = RaycastParams.new() params.FilterDescendantsInstances = {block, char} params.FilterType = Enum.RaycastFilterType.Blacklist
local camray = camera:ScreenPointToRay(X, Y) local rayCastResult = workspace:Raycast(camray.Origin, camray.Direction * 2048, params) if not rayCastResult then return end return rayCastResult.Instance, rayCastResult.Position
end
local mouseLocation = uis:GetMouseLocation()
stoneButton.MouseButton1Down:Connect(function() pframe.Visible = false
uis.InputBegan:Connect(function(m) if m.UserInputType == Enum.UserInputType.MouseButton1 then local mouseLocation = uis:GetMouseLocation() local target, position = placement(mouseLocation.X, mouseLocation.Y) if target and position then block.Parent = workspace block.CFrame = CFrame.new(position) end end end) runService.RenderStepped:Connect(function() local target, position = placement(mouseLocation.X, mouseLocation.Y) if target and position then block.Parent = workspace block.CFrame = CFrame.new(position) end end)
end)`