Yes just tried it and it works, you but do you know how i can test it to see if other players also see it? And what about the new players that join?
There is no need to send a signal to all clients to do the scale, all you need to do, is scale on the client, then scale on the server, once its done on the server, it will replicate to the other clients, and any new clients that join in.
Just go to the “TEST” Tab and click the Start, Local Server, set players for 2.
Yes that i know but that is very laggy sorry forgot to say that
You just need to check if the size replicate.
Will try this and tell you how it goes!
You can try another way using ScaleTo locally when the player is local and server when is not.
local remoteFire = Instance.new("RemoteEvent")
remoteFire.Name = "GrowScale"
remoteFire.Parent = game.ReplicatedStorage
Size.Changed:Connect(function()
if Size.Value <= 200 then
Humanoid.WalkSpeed = (defaultWalkSpeed - Size.Value/10)
if char == game.Players.LocalPlayer.Character then
remoteFire:FireClient(Size.Value,char)
else
char:ScaleTo(1 + Size.Value/100)
end
Humanoid.JumpPower = 0
Points.Value = Size.Value
PointsLabel.Text = Size.Value
end
end)
But why should I fireclient from the client? Cuz i see ur using players.localplayer
Its not from client is from server. I just move the scaleTo to client when the local-player calls and keep scaleTo from server when it’s not the local player. That way the character you control will scale locally and all the others by server. There is no need to change the localscript since fireclient and fireallclients are the same remoteEvent.
Just tried that and it doenst work the character still “teleports” even when scaling first on the client then on the server.
Weird, ok, well I guess the only option is to scale on client, and have server, send a signal to other clients, and have them do the scale on each client.
Still have the server keep track, so when a new player arrives, they can query the server, and the server give them the scale info.
What do you mean with query the server?
The default character (I tested with R15) works fine with a scaleto() locally, there is no need to scale by the server. Now custom character is just a regular model and will not propagate. Trying to scaleTo using server will lag as there is delay between client and server, I did try to change the model position by the server to compensate the scaleTo() but does not fix. It must be done using client.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteSize = ReplicatedStorage:WaitForChild("RequestSize")
local function queryAllPlayers()
local players = Players:GetPlayers()
for _, player in ipairs(players) do
local remoteSizeValue = remoteSize:InvokeServer(player.UserId)
if player. Character then
player.Character:scaleTo(remoteSizeValue)
print(player.Name .. "| New size is:".. remoteSizeValue)
end
end
end
Players.PlayerAdded:Connect(queryAllPlayers)
queryAllPlayers()
If you add this as localscript to statercharacterscripts it will run once and then again every time a player connect. It query the server using a UserID in the server you must have a datastore with player size. It will adjust que scale of all connected players.
Players.PlayerAdded:Connect(queryAllPlayers)
This code connect a function to a service that will run every time the client detects a new player connected. (It wont matter what folder you put this)
But as we need to scale player locally:
player.Character:scaleTo(remoteSizeValue)
The Character must be loaded before the scaleTo, so this is why using StarterCharacterScripts folder.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.