Discuss Scratch

DuWeido
Scratcher
1000+ posts

Roblox Studio Topic

Skibidi bibidi
-_-Onscratch
Scratcher
100+ posts

Roblox Studio Topic

Does anyone know how to make client to server events have no lag? Im working on a physics based character but when pressing left or right it has a slight bit of input lag which is bad because the game I’m working on is a precision platformer so any input lag at all is a bad sign. Also i tried doing everything on the client which would work in theory but for some reason it is impossible to make an AngularVelocity do anything on the client at least for me (for context my character is just a rotating rectangle that will have the ability to jump). So if anyone has any ideas on how to get it to work in the client or make client-to-server events have less lag that would be great.

Code for client:
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local CharacterLoaded = false
local CurrentInputValue = 0
local LastInputValue = 0
local Camera = workspace:WaitForChild("Camera")
game.ReplicatedStorage:WaitForChild("LoadedCharacter").OnClientEvent:Connect(function(Player)
	
	Character = workspace[Player]
	local CharacterTorso = Character.PlayerTorso
	
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = CharacterTorso
	CharacterLoaded = true
end)
UserInputService.InputBegan:Connect(function(Input)
	print("Start")
	if CharacterLoaded then
		if Input.KeyCode == Enum.KeyCode.A then
			Character.Move:FireServer(Vector3.new(0,0,5))
		end
		
		if Input.KeyCode == Enum.KeyCode.D then
			Character.Move:FireServer(Vector3.new(0,0,-5))
		end
	end
end)

Code for server:
script.Parent.Move.OnServerEvent:Connect(function(_, RotVelocity)
	print("Server")
	script.Parent.PlayerTorso.RotController.AngularVelocity = RotVelocity
end)

Last edited by -_-Onscratch (April 30, 2024 22:57:38)

pkhead
Scratcher
1000+ posts

Roblox Studio Topic

-_-Onscratch wrote:

Does anyone know how to make client to server events have no lag? Im working on a physics based character but when pressing left or right it has a slight bit of input lag which is bad because the game I’m working on is a precision platformer so any input lag at all is a bad sign. Also i tried doing everything on the client which would work in theory but for some reason it is impossible to make an AngularVelocity do anything on the client at least for me (for context my character is just a rotating rectangle that will have the ability to jump). So if anyone has any ideas on how to get it to work in the client or make client-to-server events have less lag that would be great.

Code for client:
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local CharacterLoaded = false
local CurrentInputValue = 0
local LastInputValue = 0
local Camera = workspace:WaitForChild("Camera")
game.ReplicatedStorage:WaitForChild("LoadedCharacter").OnClientEvent:Connect(function(Player)
	
	Character = workspace[Player]
	local CharacterTorso = Character.PlayerTorso
	
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = CharacterTorso
	CharacterLoaded = true
end)
UserInputService.InputBegan:Connect(function(Input)
	print("Start")
	if CharacterLoaded then
		if Input.KeyCode == Enum.KeyCode.A then
			Character.Move:FireServer(Vector3.new(0,0,5))
		end
		
		if Input.KeyCode == Enum.KeyCode.D then
			Character.Move:FireServer(Vector3.new(0,0,-5))
		end
	end
end)

Code for server:
script.Parent.Move.OnServerEvent:Connect(function(_, RotVelocity)
	print("Server")
	script.Parent.PlayerTorso.RotController.AngularVelocity = RotVelocity
end)
decreasing network latency is impossible. the client has to physically control their own character in order for there to be no input lag.
maybe you can't move the character because your AngularVelocity is configured incorrectly, or because the character parts are not registered as being physically controlled by the client. you can use BasePart:SetNetworkOwner from that server for that.
-_-Onscratch
Scratcher
100+ posts

Roblox Studio Topic

pkhead wrote:

-_-Onscratch wrote:

Does anyone know how to make client to server events have no lag? Im working on a physics based character but when pressing left or right it has a slight bit of input lag which is bad because the game I’m working on is a precision platformer so any input lag at all is a bad sign. Also i tried doing everything on the client which would work in theory but for some reason it is impossible to make an AngularVelocity do anything on the client at least for me (for context my character is just a rotating rectangle that will have the ability to jump). So if anyone has any ideas on how to get it to work in the client or make client-to-server events have less lag that would be great.

Code for client:
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local CharacterLoaded = false
local CurrentInputValue = 0
local LastInputValue = 0
local Camera = workspace:WaitForChild("Camera")
game.ReplicatedStorage:WaitForChild("LoadedCharacter").OnClientEvent:Connect(function(Player)
	
	Character = workspace[Player]
	local CharacterTorso = Character.PlayerTorso
	
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = CharacterTorso
	CharacterLoaded = true
end)
UserInputService.InputBegan:Connect(function(Input)
	print("Start")
	if CharacterLoaded then
		if Input.KeyCode == Enum.KeyCode.A then
			Character.Move:FireServer(Vector3.new(0,0,5))
		end
		
		if Input.KeyCode == Enum.KeyCode.D then
			Character.Move:FireServer(Vector3.new(0,0,-5))
		end
	end
end)

Code for server:
script.Parent.Move.OnServerEvent:Connect(function(_, RotVelocity)
	print("Server")
	script.Parent.PlayerTorso.RotController.AngularVelocity = RotVelocity
end)
decreasing network latency is impossible. the client has to physically control their own character in order for there to be no input lag.
maybe you can't move the character because your AngularVelocity is configured incorrectly, or because the character parts are not registered as being physically controlled by the client. you can use BasePart:SetNetworkOwner from that server for that.

Changing network owner worked but the controls kinda suck so ill work on something else until I have an idea to make it better (the reason I made this was because I made the same thing in game builder garage and the controls there were 10000000x better)

Last edited by -_-Onscratch (May 3, 2024 07:13:00)

EggPWNED
Scratcher
40 posts

Roblox Studio Topic

bump
imaminer99bro
Scratcher
5 posts

Roblox Studio Topic

Sorry to barge in about it, but here's an attempt at making the primary set from Space Ghost: Coast to Coast.
I wonder if that part of the set has an actual name…

Feel free to present some feedback!
Turbo_yeeter
Scratcher
100+ posts

Roblox Studio Topic

local function test()
Hello, fellow roblox studio coders. I'm here to announce a game called “BLOXSHED” that I've been working on. It's a randomizer type ffa inspired by Bl**dy Battle (not risking it) by Nicorocks5555 and Item Asylum made by JPX. My current idea is to have 5 weapons for each slot, and 2 maps complete with music before releasing. I have no images yet, but they'll be coming out soon.
Turbo_yeeter
Scratcher
100+ posts

Roblox Studio Topic

Question: What's a good alternative for the
part.Touched:Connect(function(hit) ... end)
function?
23mConnor
Scratcher
50 posts

Roblox Studio Topic

I’m making a detective game and so far I have a room and 4 people.
Turbo_yeeter
Scratcher
100+ posts

Roblox Studio Topic

Question, does anyone know how to import music to roblox studio without the toolbox? I'm tired of scrolling through the seven seas of jingles to get the music i need.
Marc92020
Scratcher
1000+ posts

Roblox Studio Topic

Turbo_yeeter wrote:

Question, does anyone know how to import music to roblox studio without the toolbox? I'm tired of scrolling through the seven seas of jingles to get the music i need.
you go to assets > upload file > pick audio file
(assets is the first small icon in the view tab i think)
pkhead
Scratcher
1000+ posts

Roblox Studio Topic

Turbo_yeeter wrote:

Question: What's a good alternative for the
part.Touched:Connect(function(hit) ... end)
function?
look at documentation for WorldRoot
  • ArePartsTouchingOthers
  • GetPartsInPart
but these are slower than detecting collisions with the Touched event. And the cases in which it's best to use these don't come up often.
BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

pkhead wrote:

theyre adding the ability to change where voice chat audio is playing from the world as well as the ability to apply effects on it.
someone should make a shameless lethal company clone.
I was always surprised this didn’t come with voice chat implementation, I can see a lot of games where global voice chat would be good
os_player
Scratcher
100+ posts

Roblox Studio Topic

any best plugin that are code using scratch because i dont understand lua
Marc92020
Scratcher
1000+ posts

Roblox Studio Topic

os_player wrote:

any best plugin that are code using scratch because i dont understand lua
i remember seeing a plug-in that lets you code using blocks but i forgot what it’s called
i found one just now, but it costs money (i dont like how roblox made plugins paid with real money) so idk if i can link it or not
os_player
Scratcher
100+ posts

Roblox Studio Topic

Marc92020 wrote:

os_player wrote:

any best plugin that are code using scratch because i dont understand lua
i remember seeing a plug-in that lets you code using blocks but i forgot what it’s called
i found one just now, but it costs money (i dont like how roblox made plugins paid with real money) so idk if i can link it or not
i installed the free one that i saw on forum and it has scratch ui but probably i cant understand the code bloks because it makes me not understand but idk if i will link here but i leave it morse code to link it here
cake__5
Scratcher
100+ posts

Roblox Studio Topic

i have a chromebook. where do i get roblox studio? (i hate being stuck with retrostudio)
Turbo_yeeter
Scratcher
100+ posts

Roblox Studio Topic

cake__5 wrote:

i have a chromebook. where do i get roblox studio? (i hate being stuck with retrostudio)
That's the thing, chromebooks can't run .exe files…
Turbo_yeeter
Scratcher
100+ posts

Roblox Studio Topic

…dead topic?
BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

cake__5 wrote:

i have a chromebook. where do i get roblox studio? (i hate being stuck with retrostudio)
There isn't really a way to run roblox studio on chromebooks, sadly. I'm sure you could find a workaround using Linux but even then there's no official support, and if the device isn't yours I doubt whoever owns it will be happy with you installing an alternative OS

Powered by DjangoBB