-
What do you want to achieve? Keep it simple and clear!
I want the HumanoidRootPart’s RootJoint.Transform of the player who fires the RemoteEvent to be replicated server-side so others can see it. -
What is the issue? Include screenshots / videos if possible!
When ran without any events, others cannot see the tilt it but it works. However, when trying to run it server-side, no one can see the tilt at all. Not even you.
(the test print does work though) -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have searched for solutions but I haven’t found any related to mine. If there is one, please link it! I’d appreciate it.
Tilt Code [LocalScript in StarterCharacterScripts]:
function Lerp(a, b, t)
return a + (b - a) * t
end
local STEP = 0.1
local RunService = game:GetService("RunService")
function getYaw(vec)
return -math.atan2(vec.Z, vec.X) - math.pi/2
end
local lastFrameDir = script.Parent.HumanoidRootPart.CFrame.lookVector
local lastDir = lastFrameDir
local dir = lastDir
local accum = 0
local rollGoal = 0
local roll = 0
RunService.Stepped:Connect(function(t, dt)
accum = accum + dt
lastFrameDir = dir
dir = script.Parent.HumanoidRootPart.CFrame.lookVector
local angleDiff = getYaw(dir) - getYaw(lastFrameDir)
angleDiff = (angleDiff + math.pi/2) % math.pi - math.pi/2
local sign = angleDiff < 0 and -1 or 1
if accum > STEP then
local diff = 1 - lastDir:Dot(dir)
rollGoal = diff * math.rad(40) * sign
lastDir = dir
accum = 0
end
roll = Lerp(roll, rollGoal, 0.2)
--script.Parent.HumanoidRootPart.RootJoint.Transform = script.Parent.HumanoidRootPart.RootJoint.Transform * CFrame.Angles(0, roll, 0)
game.ReplicatedStorage.ReplicateTilt:FireServer(script.Parent.HumanoidRootPart.RootJoint, roll)
end)
Event Manager [Script in ServerScriptService]:
game.ReplicatedStorage.ReplicateTilt.OnServerEvent:Connect(function(player,joint,roll)
joint.Transform = joint.Transform * CFrame.Angles(0, roll, 0)
print'success firing event'
end)
If you’re going to link any “unreplicated” screenshots, explaining or some sample code would be appreciated. I don’t think this is the error though, but who knows?