#how to fix?
243 messages · Page 1 of 1 (latest)
renderstepped is interfering
with the inputbegan
thats why
rotation doesnt work
but im not sure
how to fix it
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
oh
And you set new CFrame without orientation data
Either set wall.Position = Mouse.Hit.Position
oh
Well no problem, CFrame is a bit more advanced comparing to simple Vector3
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
well you will need to do some math
you will need to get the height of your Instance, divide it by 2 and add it to the height of the mouse position
what
mmmmmmmmmmmmmmmmmmmmmmhhhhhhhhmmmmmm
no
wall.Position = Mouse.Hit.Position + Vector3.new(0,wall.Size.Y/2,0)
Your Instance of wall is a Part correct?
That Instance has alot of properties, one of the properties is size
that basically
should've let him figure it out himself tbh, but whatever
he doesnt know
yes
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
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)
= 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
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
?
Max distance?
Like how far can you put the wall using the mouse?
not that
I want it to be able to only move on parts
if anywhere else, it just stops
why do i keep saying if instead of it
well check what mouse hits
should i use
You're doing raycast correct?
no
I actually have no idea how to use raycasts
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
mouse.Target
ah it's some service... Nevermind what I said
this yes?
what
you cant put the part on top of an object that isnt a part
man
its works
whats the point
oh
then?
basepart
what do
I make it
to
if Mouse.Target:IsA("BasePart") then
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
** You are now Level 4! **
DO WHAT
use mouse.target
well if you want to only put your wall on other parts, then you don't need to do nothing
into the void
IT WONT
ok
IT WILL NOTTTTTTTTTTTTTTTTTTTTTTTT
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
REMOVE THAT PART OF the SCRIPTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
ok
so
how would I make it so it cant go into the void
even if your mouse
moves there
IT WONT
actually wait
@neat junco what does mouse world position output when not hitting a part?
?
@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
nil i think
mhm
yeah
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
alright
tho I hate errors, that's why I would still check if it has position
ACTUALLY NVMMMMMMMMM
?
IT DOES HAVE A POSITION
mhm?
it showed this error
if Mouse.Target then
just do this
no you just set your position asignment logic inside of the if block
alr
huh
?
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
what's up
How would I transfer the data
of position
, orientation
to the server
to place the part
mmmmmmmm
use remote events
remote:FireServer(wall.CFrame)
ah
and setup server script in serverscript storage
I did
i would put
function(CFrame)
ye
yes
wait let me try it
firing remote event from client sends player data by default AND then only the variables you assigned
yeah
so if you just do function(CFrame) it will assign player to that
forgot about it
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
in any case of OnServerEvent you have to specify the player
--local
Mouse.Button1Down:Connect(function()
Event:FireServer(wall.CFrame)
end)
change that to
Wall.CFrame = Position