#How to make char facing to mouse
1 messages · Page 1 of 1 (latest)
what?
ig change its CFrame to look at the camera position using CFrame.Lookat?
ye but i can get mouse only on client side and changing CFrame there only affect for client
and server cant see it
then get the end position that you want the character to be at and send it using a remote event to the server to be changed from there
have you... maybe, perhaps, actually tried it, maybe?
game.ReplicatedStorage.OneButton.OnClientEvent:Connect(function(bool)
local cycle
if bool then
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:Wait()
local hrt: Part = char:WaitForChild("HumanoidRootPart")
cycle = game["Run Service"].RenderStepped:Connect(function()
local hitpos = mouse.Hit.Position
hrt.CFrame = CFrame.new(hrt.Position, hitpos)
end)
end
if not bool then
cycle:Disconnect()
end
end)
here is script
actually i tried
it doesnt work
in global
or local server play test
at least you didn't use ai for that
only player can see it
points for effort?
xd
send the cframe to the server and that should be global
ye ik but i want make that its gonna be looking like aiming
not one end point sending
so you want to use heartbeat?
also tried AlignOrientation but im anchoring char so it doesnt work
i dont want to spamm FireServer() thing
but if its only the way
if you want it server sided you gotta fire to the server. Unless you make the server control the "ability"
just tested it and it works fine
did you try to see it form server side?
yes, working as expected
you dont need to send it to server, the client already has network ownership of their character, so changing the cframe on the client will send it to the server automatically
...
i think that's the problem. he might not be using the player's character
or you did something else dum
oh
nah
anchored thing doesnt allow to move character
like client see
but server cant cus of anchor
anyway
thx
anchoring will give network ownership to the server
toyall