As you possibly (unlikely) already know, I'm working on a 2D platformer framework, everything was going great, until I run into a problem: it's bugged in server mode. I'm sure it's because I constantly reposition the custom player in this line of code:
plr.CFrame = CFrame.new(plr.CFrame.x,plr.CFrame.y,0)*CFrame.Angles(0,0,math.rad(180))
to keep the player upright and at 0 on the Z axis at all times, It works in run mode, but in server mode it's "teleporty" I tried to use rotation to set the angle and ( and had also tried rotation and .Position for movement), which worked, until I hit a trigger (an invisible part used to launch a scripted event) and flew to the top of it. I then tried bodyforce, which worked (ignoring the "fling physics 10/10" <- Said on my stream by a twitch user.) and the fact that the player was still not locked to 0 on the Z axis.
Can anyone help me?
Move movement coroutine:
plrControl = coroutine.wrap(function()
game:GetService("RunService").RenderStepped:connect(function()
plr.CFrame = CFrame.new(plr.CFrame.x,plr.CFrame.y,0)*CFrame.Angles(0,0,math.rad(180))
plr.Velocity = Vector3.new(plr.Velocity.x/1.25,plr.Velocity.y/1.05,0)
--[[if plr.Position.z ~= 0 then
plr.Position = Vector3.new(plr.Position.x,plr.Position.y,0)
end]]--
--[[if ks[Enum.KeyCode.W] and ks[Enum.KeyCode.A] then
elseif ks[Enum.KeyCode.W] and ks[Enum.KeyCode.D] then
elseif ks[Enum.KeyCode.S] and ks[Enum.KeyCode.A] then
elseif ks[Enum.KeyCode.S] and ks[Enum.KeyCode.D] then]]--
if ks[Enum.KeyCode.W] then
elseif ks[Enum.KeyCode.S] then
elseif ks[Enum.KeyCode.A] then
plr.Velocity = Vector3.new(-25,plr.Velocity.y,0)
elseif ks[Enum.KeyCode.D] then
plr.Velocity = Vector3.new(25,plr.Velocity.y,0)
end
if ks[Enum.KeyCode.Space] and jump ~= true then
jump = true
if _G.settings.plrJmpTyp == 0 then
plr.Velocity = Vector3.new(plr.Velocity.x,50,0)
elseif _G.settings.plrJmpTyp == 1 then
for i=1, 10 do
plr.Velocity = Vector3.new(plr.Velocity.x,i*5,0)
end
end
repeat wait(0.05) until plrGrounded() == true
plr.Velocity = Vector3.new(plr.Velocity.x,0,0)
jump = false
end
end)
end)
also, if you feel the need to read all of my code, which I highly assumed would be TL;DR for most people: http://pastebin.com/irU7reP0
