How to make server-sided changes NOT replicate

I’m making a soccer game, and there’s an issue where the ball collides with the player but doesn’t actually register a touch, this is because the player’s character on the server is at a different position than the player’s character on their client (I suspect). The only way I know to fix it would be to have different properties on client and server, but I don’t know how to accomplish this because server changes will always replicate to client (at least when I was trying it) and I don’t want to just do some hacky solution, so is there a better way of doing this?

maybe a localscript inside startercharacterscripts with a touch event? then fire a remote event and do a sanity check on server

2 Likes

You will probably be flabergasted but local player can fire touch event from literally anywhere and server will register it…
So no its definatly not a problem but you probably have gotten another problem with that :rofl:

2 Likes

Do you ever teleport the character for any reason?

2 Likes

…and that’s why you implement magnitude checks!
NEVER trust the client for any information, always check.

3 Likes

I would use tags, tag the ball on the server, perhaps set some attributes connect to a

game.CollectionService.InstancedAdded("Soccerball"):Connect(function()
end)
game.CollectionService.InstancedAdded(game.Players.LocalPlayer.UserId):Connect(function()
end)

soccerball:AddTag(“Soccerball”)

1 Like

To everyone confused, I probably should’ve given more context. I am working on a TOUCH FOOTBALL game but I have a problem. Sometimes when the ball is rolling towards your player, the ball will suddenly slow down, as if something hit it. I ended up determining that this was something to do with the character and server-side vs client-side.

So far, my solution for this was to just constantly loop in a CLIENT-SIDE script to check that the properties of every part matches what it’s supposed to be and if not I’ll set it. (The change ended up not replicating on the server and now it works)

local StarterPlayer = game:GetService("StarterPlayer")

local character = script.Parent
local starterCharacter = StarterPlayer:WaitForChild("StarterCharacter")

local partsSet = {}

repeat
	for _, child in character:GetChildren() do
		if child:IsA("BasePart") then
			child.CollisionGroup = starterCharacter[child.Name].CollisionGroup
			child.CustomPhysicalProperties = starterCharacter[child.Name].CustomPhysicalProperties

			partsSet[child] = true
		end
	end

	task.wait()
until #partsSet == 7 -- Number of limbs

Basically, my solution for the main issue I mentioned was to just make the server character have a collision group that doesn’t collide with the ball at all. But on the client your character, your character WILL collide with it. My hit-detection is all client sided anyways (to mitigate delay and make it fluid and responsive) so I just needed to figure out how to do this.

The best way to approach physics would be debug the custom physical properties of the ball, a good starting point would be rubber. Then you look here at the documentation Materials | Documentation - Roblox Creator Hub and find the ctrl+f “Rubber”
take note of the physical properties and adjust them to achieve the physics of a soccer ball. Probably less bouncier than rubber.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.