I am attempting on changing the players characters torso orientation to appear on other clients via the server. It prints out saying its played with the x, y, z inputs to the server but does not appear on the server.
Code:
-- events is a table that holds all events inside replicated storage.
-- Edit to your needs for your own debugging.
events.UpdateLeanGlobal.OnServerEvent:connect(function(player, x, y, z)
local TweenService = game:GetService("TweenService")
local torso = player.Character:WaitForChild('Torso')
-- Create the target CFrame rotation based on the given x, y, and z angles
local targetRotation = CFrame.Angles(x, y, z)
-- Tween the torso's orientation to the target rotation
TweenService:Create(torso, TweenInfo.new(0.5), {CFrame = targetRotation}):Play()
print(x, y, z, 'Played')
end)
i dont think you can move the torso itself, because heres what i did and it worked (i tested with random x,y,z vakues)
-- events is a table that holds all events inside replicated storage.
-- Edit to your needs for your own debugging.
local TweenService = game:GetService("TweenService")
events.UpdateLeanGlobal.OnServerEvent:Connect(function(player, x, y, z)
local hrp = player.Character:WaitForChild('HumanoidRootPart')
-- Create the target CFrame rotation based on the given x, y, and z angles
local targetRotation = CFrame.Angles(x, y, z)
-- Tween the torso's orientation to the target rotation
TweenService:Create(hrp, TweenInfo.new(0.5), {CFrame = targetRotation}):Play()
print(x, y, z, 'Played')
end)
also, in line 1 did you mean that events was a folder/model in replicatedstorage?
1 Like
Events are inside of their own folder for certain things. So for instance the Gun system is in one, movement (seperate from the weapon system) is in another etc
I put them within a table for easy of use aswell as for it to look nicer in the little auto completetion box
also make sure to mark me as a solution if i helped to let people know that its resolved
I am aware lol I havent gotten around to applying the code and checking if it works.
oh my bad, this is my first post on here and i thought it would be cool to help people
forgot to reply, I had tried the edit but that just flung the player. Edited it and tweaked it didnt work so I am just gonna apply an animation and play it untill the users lean stance changes.