#Placement System Error Part 1

1 messages · Page 1 of 1 (latest)

sand gate
#

Guys i am having a problem with a placement system, it should be all fine, it has many scripts, and a remote event but no blocks appear and there is an error in a script, that says GetMouseLocation is not a valid member of PlayerMouse "Instance" - Client - LocalScript:12 it is in this script:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local function updateMousePosition()
    local mousePosition = mouse:GetMouseLocation()--this is the error--
    game.Workspace.csip.Position = Vector3.new(mousePosition.X, mousePosition.Y, 0)
end
mouse.Move:Connect(updateMousePosition)
updateMousePosition()

Next code in Part 2
Could you say the problem?
Thanks

#

Part 2
Is there a problem with the form of these numbers of position?
The other scripts are:

local module = {}
local interpolation = true
local moveByGrid = true
local buildModePlacement = true
local rotationStep = 90
local maxHeight = 90
local lerpLevel = 0.7
local gridTexture = ''
local placement = {}
placement.__index = placement
local players = game:GetService('Players')
local runService = game:GetService('RunService')
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local GRID_SIZE
local ITEM_LOCATION
local ROTATE_KEY
local TERMINATE_KEY
local object
local placedObjects
local plot
local stackable
local posx
local posy
local posz
local speed = 1 

More in the next message

#
local function calcolateYPosition()    
end
local function snap(x)
    return math.ceil((x/GRID_SIZE) - 0.5)*GRID_SIZE
end
local function calculateItemPosition()
    if moveByGrid then
        posx = snap(mouse.Hit.X)
        posy = mouse.Hit.Y
        posz = snap(mouse.Hit.Z)
        else
        posx = mouse.Hit.X
        posy = mouse.Hit.Y
        posz = mouse.Hit.Z
    end
end
local function translateObj()
    if placedObjects and object.parent == placedObjects then
        calculateItemPosition()
        object:PivotTo(object.primaryPart.Cframe:Lerp(CFrame.new(posx, posy, posz), speed))
    end
end
local function approvePlacement()
return true
end
function placement.new(g, objs, r, t)
    local data = {}
    local metaData = setmetatable(data, placement)
    GRID_SIZE = g
    ITEM_LOCATION = objs
    ROTATE_KEY = r
    TERMINATE_KEY = t
    data.grid = g -- grid
    data.itemlocation = ITEM_LOCATION
    data.rotatekey = r
    data.terminatekey = t
    return data

end

--activates placement (id = name, pobjs = placed objects, plt = plot, stk = stackable)
function placement:activate(id, pobjs, plt, stk)
    object = ITEM_LOCATION:FindFirstChild(id):Clone()
    placedObjects = pobjs
    plot = plt
    stackable = stk
    if not approvePlacement() then
        return 'placement could not activate'
    end
    if not stk then
        mouse.TargetFilter = placedObjects
        else
        mouse.TargetFilter = object
    end
        local preSpeed = 1
        if interpolation then
            preSpeed = math.clamp(math.abs(tonumber(1-lerpLevel)), 0, 1)
            speed = 1
        end
        object.parent = placedObjects
        wait()
        speed = preSpeed
end
wait(1)
runService:BindToRenderStep('Input', Enum.RenderPriority.Input.Value, translateObj)
return placement
hot spade
#

Says in the error? I’m not sure I remember a method called GetMouseLocation

sand gate
#

Is it position instead?

hot spade
#

It’s just mouse.X and mouse.Y

#

According to the docs

red bolt
vocal marshBOT
#

studio** You are now Level 2! **studio

red bolt
#

It’s :GetMouse

#

And then you can use mouse.X and mouse.Y

#

Usually they set it as

#

Local Mouse = player:Getmouse()

glass plank
#

i got you guys dont worry here

#

local InputuserService = game:GetService("UserInputService")

local player = game:GetService("player").IocalPlayer

local mouse = player:GetMouse()

UserInputService.InputBegan:Connect(function(input)
if put.UserInputType == Enum.UserInputType.MouseButton1 then
local part = instance new("Part")
part.Anchord = true
part.BrickColor = part.BrickColor.new(Really black")
part.Position = mouse.Hit.Position
part.Parents = workspace
end
end)