#how to get orientation of CFrame and give it to server
91 messages · Page 1 of 1 (latest)
nvm
forgot about it
i has another problem
why i can't just
send model from local script to server?
because
the model doesnt exist on server
only on client
how can it receive something
that doesnt exist
in reality
roblox does not allow me to get with CFrame orientation and does not allow me to forward the object to the server, what the hell
:FireServer(Model:GetPivot())
and on server
u get the cframe
and create the model
and
NewDoor:PivotTo(cframeReceived)
yeah i tested it, it also not worked i will try again
getpivot and pivotto , SetPrimaryPartCFrame etc not works
i will try again.
code
one sec
--server
game.ReplicatedStorage.Build.OnServerEvent:Connect(function(plr,nam,cfr)
local moddel = game.ReplicatedStorage.Buildings:FindFirstChild(nam):Clone()
moddel:PivotTo(cfr)
moddel.Parent = game.Workspace
end)
--client
local UIS = game:GetService("UserInputService")
script.Parent.MouseButton1Click:Connect(function()
local Plr = game.Players.LocalPlayer
local mouse = Plr:GetMouse()
local Model = game.ReplicatedStorage.Buildings:FindFirstChild(script.Parent.Parent.Name)
if Model then
Model = Model:Clone()
Model.Name = Model.Name.."' Build"
Model.Parent = game.Workspace
else
warn("Model not found")
end
mouse.Move:Connect(function()
m = game.Workspace:FindFirstChild(Model.Name)
if m ~= nil then
mouse.TargetFilter = m
hitPosition = mouse.Hit.p
m:SetPrimaryPartCFrame(CFrame.new(hitPosition))
end
end)
UIS.InputBegan:Connect(function(input,chat)
if input.KeyCode == Enum.KeyCode.R and chat == false then
m.PrimaryPart.CFrame *= CFrame.Angles(0,-45,0)
m:SetPrimaryPartCFrame(CFrame.new(hitPosition))
end
end)
mouse.Button1Down:Connect(function()
game.ReplicatedStorage.Build:FireServer(script.Parent.Parent.Name,Model:GetPivot())
end)
script.Parent.Parent.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
Model:Destroy()
end)
end)
yeah
m:PivotTo(m:GetPivot() * CFrame.Angles(0, math.rad(-45), 0))?
why are u checking
PrimaryPart cframe
ur not setting the models orientation
only the primary part
I've never tried to rotate models, so it was written by a chatgpt
💀
idk how to rotate model, i tried to just use "Orientation" but its says nil
code
np
now I will know how to rotate the models
good
with what
wym
Well, that is, as you can see, the door looks in the direction where the player's mouse is pointing
yea
I want the door to be on a horizontal plane.
ur still using SetPrimaryPartCFrame for this
coudl u record whats happening cuz the image is weird
i using PivotTo
send code
lol nvm i fixed it just by PivotTo(CFrame.New(hitposition))
also thanks for fast reply
???????????
JUST SAID THAT
.
YES?
THATS WHAT I TOLD U TO DO
and said
ur using SetPrimaryPartCFrame
u said
"nope"
well, in general, it doesn't matter anymore, the main thing is that everything has been fixed.
nice