How would I make a block follow the cursor?
I want the block to follow the cursor and be visible on both the client and server.
How would I complete this.
How would I make a block follow the cursor?
I want the block to follow the cursor and be visible on both the client and server.
How would I complete this.
i dont feel like testing any script but this could maybe work
make a remote event
client: get the mouse and its 3d position then fire the remote to the server giving it the mouse’s 3d position (fires every frame or something idk)
server each time it gets that it changes a pre-mades part’s location to the mouses location
im not scripting it im too lazy ok but that would probably work
Do you mean like a building-type system placement thing? You can use Camera:ScreenPointToRay
on the client. The client should use a part that the server gives them network ownership of.
Client:
local uis = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
local part = script.Part
local char = player.Character or player.CharacterAdded:Wait()
local params = RaycastParams.new()
params.FilterDescendantsInstances = {char}
params.IgnoreWater = true
params.FilterType = Enum.RaycastFilterType.Exclude
local function update()
local pos = uis:GetMouseLocation()
local ray = cam:ScreenPointToRay(pos.X, pos.Y)
local hit = workspace:Raycast(ray.Origin, ray.Direction * 20, params)
if hit then
part.CFrame = CFrame.new(hit.Position)
end
end
mouse.Move:Connect(update)
No, I just want a block to follow the mouse.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.