Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with remoteEvent (I think)?

Asked by
NordicM 77
4 years ago

Hi! I'm making a game where you are a ball and you can move around and stuff. I'm trying to make it work server side so people can see each other. I've come to a problem where I can move on roblox studio but not on servers. Am I doing something wrong. Am I firing the remoteEvent to fast? Here's a part of my code that sends information to my serverscript

--//LOCAL SCRIPT LOCATED IN THE STARTERPLAYERSCRIPTS//--
while wait(0.05) do
    if A and D and W and S then
        ControlEvent:FireServer(Vector3.new(0, 0, 0))
    elseif A and D and W then
        ControlEvent:FireServer(camera.CFrame.RightVector*-speed)
    elseif D and W and S then
        ControlEvent:FireServer(camera.CFrame.LookVector*speed)
    elseif W and S and A then
        ControlEvent:FireServer(camera.CFrame.LookVector*-speed)
    elseif S and A and D then
        ControlEvent:FireServer(camera.CFrame.RightVector*speed)
    elseif A and D then
        ControlEvent:FireServer((camera.CFrame.LookVector*-speed)+(camera.CFrame.LookVector*speed))
    elseif D and W then
        ControlEvent:FireServer((camera.CFrame.LookVector*speed)+(camera.CFrame.RightVector*-speed))
    elseif W and S then
        ControlEvent:FireServer((camera.CFrame.RightVector*-speed)+(camera.CFrame.RightVector*speed))
    elseif S and A then
        ControlEvent:FireServer((camera.CFrame.RightVector*speed)+(camera.CFrame.LookVector*-speed))
    elseif A and W then
        ControlEvent:FireServer((camera.CFrame.LookVector*-speed)+(camera.CFrame.RightVector*-speed))
    elseif D and S then
        ControlEvent:FireServer((camera.CFrame.RightVector*speed)+(camera.CFrame.LookVector*speed))
    elseif A then
        ControlEvent:FireServer(camera.CFrame.LookVector*-speed)
    elseif D then
        ControlEvent:FireServer(camera.CFrame.LookVector*speed)
    elseif W then
        ControlEvent:FireServer(camera.CFrame.RightVector*-speed)
    elseif S then
        ControlEvent:FireServer(camera.CFrame.RightVector*speed)
    else
        ControlEvent:FireServer(Vector3.new(0, 0, 0))
    end
end

--//SCRIPT LOCATED IN SERVERSCRIPTSERVICE//--
function Controller(player, velocity)
    game.Workspace:FindFirstChild("Ball".. player.Name).Ball.BodyAngularVelocity.AngularVelocity = velocity
end

If I put more wait on the wait it will be input delay, so I don't wanna do that. If you want me to post the hole script. Let me know in the comments. This started happening when I did this, so this may be the problem...

--//LOCAL SCRIPT LOCATED IN THE STARTERGUI//--

local StarterGui = game:GetService("StarterGui")

while not success do
    success = pcall(function()
        StarterGui:SetCore("TopbarEnabled", false)
        StarterGui:SetCore("ResetButtonCallback", false)
    end)
    if success then
        break
    end
    wait(.2)
end
0
Any error messages? Nckripted 580 — 4y
0
If theres no errors try printing the line that wont work so its easy to debugg and we can help you. JesseSong 3916 — 4y
0
No error messages. NordicM 77 — 4y

Answer this question