Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i fix cursor inverted position? [closed]

Asked by 10 years ago

I am making a 2008 simulator and i've made a local part that is like green cursor block. I tried this script:

local localplayerr = game.Players.LocalPlayer

local character = localplayerr.Character or localplayerr.CharacterAdded:wait()

local bin = Instance.new("Message")
bin.Name = 'LocalBin'
bin.Parent = character

local platform = Instance.new("Part")
platform.Name = "CursorSelection"
platform.BrickColor = BrickColor.new("Lime green")
platform.Material = Enum.Material.Plastic
platform.BottomSurface = Enum.SurfaceType.Smooth
platform.TopSurface = Enum.SurfaceType.Smooth
platform.FrontSurface = Enum.SurfaceType.Smooth
platform.LeftSurface = Enum.SurfaceType.Smooth
platform.CanCollide = false
platform.Anchored = true
platform.Size = Vector3.new(2, 0.2, 2)

local msh = Instance.new("CylinderMesh")
msh.Name = "Circle"
msh.Parent = platform

platform.Parent = bin -- Now GREEN CIRCLE appears

wait(1)
function SetCursorPosition()
while true do
    wait()
    platform.Position = Vector3.new(localplayerr:GetMouse().X / 32, localplayerr:GetMouse().Y / 32, character.Torso.Position.Z * 32)
end
end

Spawn(SetCursorPosition)

The problem is at SetCursorPosition platform.Position...

The block is getting inverted position of cursor! Please help Thanks ~marcoantoniosantos3

0
Are you trying to make the green part appear where the cursor is pointing? 2eggnog 981 — 10y

Locked by Shawnyg and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

Try changing

wait(1)
function SetCursorPosition()
while true do
    wait()
    platform.Position = Vector3.new(localplayerr:GetMouse().X / 32, localplayerr:GetMouse().Y / 32, character.Torso.Position.Z * 32)
end
end

Spawn(SetCursorPosition)

to this:

local mouse = localplayerr:GetMouse()

Game:GetService("UserInputService").InputChanged:connect(function(inst)
    platform.Position = mouse.Hit.p + Vector3.new(0, .1)
end)
0
Thanks! It's working now! marcoantoniosantos3 200 — 10y
Ad