#how to fix?

243 messages · Page 1 of 1 (latest)

supple schooner
#

from what I know

#

renderstepped is interfering

#

with the inputbegan

#

thats why

#

rotation doesnt work

#

but im not sure

#

how to fix it

ruby tapir
#

If it's Interfering, it's interfering because you're using CFrame instead of position

#

CFrame is both for orientation and position of an instance

supple schooner
#

oh

ruby tapir
#

And you set new CFrame without orientation data

#

Either set wall.Position = Mouse.Hit.Position

supple schooner
#

oh

ruby tapir
#

Or include old wall Orientation into the new CFrame

#

with the mouse position

supple schooner
#

ok

#

ah your right

#

its working

#

sry im new to making this type

#

of scripts

ruby tapir
#

Well no problem, CFrame is a bit more advanced comparing to simple Vector3

supple schooner
#

wait

#

can I get the position to be on the ground

#

because right now

#

its sticking half of its size

#

into the floor

#

@ruby tapir

ruby tapir
#

you will need to get the height of your Instance, divide it by 2 and add it to the height of the mouse position

supple schooner
#

what

neat junco
#

mmmmmmmmmmmmmmmmmmmmmmhhhhhhhhmmmmmm

supple schooner
#

like wall.position / 2

#

?

ruby tapir
#

no

neat junco
#

wall.Position = Mouse.Hit.Position + Vector3.new(0,wall.Size.Y/2,0)

ruby tapir
#

Your Instance of wall is a Part correct?
That Instance has alot of properties, one of the properties is size

ruby tapir
#

should've let him figure it out himself tbh, but whatever

neat junco
#

he doesnt know

neat junco
#

that he has to use the Y

#

aka height

supple schooner
#

oh

#

wait

#

ah

#

so it is divided by 2

#

i was right

#

but

#

put it in a vector3

#

and in the current position

#

i was going to do that

#

but assumed

#

it was going to bug it

ruby tapir
#

it won't

#

When you set an Instance to be positioned somewhere, it positions itself always by the center of that mesh (unless you change the pivot position)

supple schooner
#

how would I be able to make a max distance

#

for it

#

hm

neat junco
#

= firstvalue + secondvalue, firstvalue is the main value and it will be used as the part's main position, and the secondvalue is what you add on top of it

ruby tapir
#

Having that knowledge, to position it on top of the surface, you just need to get the distance from the center to the bottom of mesh

supple schooner
ruby tapir
supple schooner
#

for the part

#

to be moved to

ruby tapir
#

Like how far can you put the wall using the mouse?

supple schooner
#

not that

#

I want it to be able to only move on parts

#

if anywhere else, it just stops

neat junco
#

why do i keep saying if instead of it

ruby tapir
#

well check what mouse hits

supple schooner
#

should i use

supple schooner
#

ohh

ruby tapir
#

You're doing raycast correct?

supple schooner
#

no

ruby tapir
#

Check the raycast's hitted instance, if it's of type Part, then let it run

#

mhm?

supple schooner
#

ah

#

alright

supple schooner
ruby tapir
#

Wait if you're not using raycasts, what are you using then to get world position

#

Well I get it but I'm not too sure how else could you get mouse world position

neat junco
#

mouse.Target

supple schooner
#

ah

#

i was wondering what that did

#

if Mouse.Target:IsA("Part") then

ruby tapir
supple schooner
neat junco
#

you cant put the part on top of an object that isnt a part

#

man

supple schooner
#

its works

neat junco
#

whats the point

supple schooner
#

then?

#

basepart

#

what do

#

I make it

#

to

neat junco
#

whatttttttt

#

what the fuck do you mean

#

man

supple schooner
#

if Mouse.Target:IsA("BasePart") then

ruby tapir
#

What dan tried to say is that it won't put a part on top of nothing if you put your mouse in the direction of skybox

cunning fogBOT
#

studio** You are now Level 4! **studio

supple schooner
#

oh

#

how would

#

I do it then

#

?>

neat junco
#

DO WHAT

supple schooner
#

use mouse.target

supple schooner
#

it doesnt go into thin air

#

and fall down

ruby tapir
#

well if you want to only put your wall on other parts, then you don't need to do nothing

supple schooner
#

into the void

neat junco
#

IT WONT

supple schooner
#

until

#

your mouse

#

moves

#

back

neat junco
#

IT WILL NOTTTTTTTTTTTTTTTTTTTTTTTT

supple schooner
#

it works perfectly fine

#

but

#

Players.player.PlayerScripts.LocalScript:19: attempt to index nil with 'IsA' - Client - LocalScript:19

#

this error literally does nothing

#

except

#

for slow the movement for 0.1s

neat junco
#

REMOVE THAT PART OF the SCRIPTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT

supple schooner
#

ok

#

so

#

how would I make it so it cant go into the void

#

even if your mouse

#

moves there

ruby tapir
#

IT WONT

#

actually wait

#

@neat junco what does mouse world position output when not hitting a part?

supple schooner
#

?

ruby tapir
#

@supple schooner you need to understand that you are using a service which returns you the position of cursor in 3d perspective. It uses raycast for that, basically shoots a stright like from your mouse on screen to the closest Instance it can hit

ruby tapir
ruby tapir
#

If it's actually nil then it will just error out and keep the part at the last proper position

#

And RenderStepped won't break

supple schooner
#

alright

ruby tapir
#

tho I hate errors, that's why I would still check if it has position

neat junco
#

ACTUALLY NVMMMMMMMMM

supple schooner
#

?

neat junco
#

IT DOES HAVE A POSITION

ruby tapir
#

mhm?

neat junco
#

but it doesnt have a target

#

so

#

thats why

supple schooner
#

so which mouse function do I use

#

oh

neat junco
supple schooner
#

might not error

#

out

neat junco
ruby tapir
#

no you just set your position asignment logic inside of the if block

supple schooner
#

alr

ruby tapir
#

if Mouse.Target then
-- Your logic here
end

#

just as dan said

#

if is a conditional statement and it provides you with a closed off code block

#

code block is anything that is enclosed, functions provide you with the code block also.

#

if "condition" then
-- this is if statement's code block
end

#

function something()
-- this is function's code block
end

#

anything that you put inside the code block will run when you run it either with condition or calling out the function

supple schooner
#

hm

#

I see

#

alright

supple schooner
#

@ruby tapir

#

okay

#

im kind of confused here

#

again

ruby tapir
#

what's up

supple schooner
#

How would I transfer the data

#

of position

#

, orientation

#

to the server

#

to place the part

neat junco
#

mmmmmmmm

ruby tapir
#

use remote events

supple schooner
#

I did

#

but how would I?

neat junco
#

remote:FireServer(wall.CFrame)

supple schooner
ruby tapir
#

and setup server script in serverscript storage

supple schooner
#

I used position

#

🤦‍♂️

supple schooner
neat junco
#

you would

supple schooner
#

i would put

neat junco
#

part.CFrame = cframe

#

cframe =

#

um

#

wiat

supple schooner
#

function(CFrame)

neat junco
#

ye

supple schooner
#

and use it

#

yeah

neat junco
#

yes

supple schooner
#

wait let me try it

ruby tapir
#

it would be

#

wait

#

it would be function(player, CFrame)

supple schooner
#

what

#

why

ruby tapir
#

firing remote event from client sends player data by default AND then only the variables you assigned

neat junco
supple schooner
#

oh

#

let me try

neat junco
#

you have to specify the player

#

otherwise it wont work

ruby tapir
#

so if you just do function(CFrame) it will assign player to that

neat junco
#

forgot about it

supple schooner
#

well a problem has occured

#
local RS = game:GetService("ReplicatedStorage")

local Event = RS:WaitForChild("Placed")

Event.OnServerEvent:Connect(function(player, Position)
    local Wall = Instance.new("Part")
    Wall.Parent = game.Workspace.Placed
    
    Wall.Position = Vector3.new(Position)
    
    Wall.Anchored = true
    Wall.Transparency = 0
    Wall.CanCollide = true
end)
#

server

neat junco
#

in any case of OnServerEvent you have to specify the player

supple schooner
#

--local

Mouse.Button1Down:Connect(function()
    Event:FireServer(wall.CFrame)
end)
neat junco
#

Wall.CFrame = Position

supple schooner
#

ah

#

alright

supple schooner
#

so no vector3

#

?

#

ah i see

#

because there is already an assigned value

#

to it

#

so it works

#

without a new vector3

neat junco
#

Vector3 ~= CFrame

#

Vector3 = Position and not orientation

#

but cframe

#

is position + orientation