Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to resize my character Server-sided?

I'm working on a game where you use tools to resize your character. They are fixed sizes, but the grow and shrink have the same problem: It only changes the character's size on the client. And I don't know how to make it server-sided. Please help! Here's the code for the small character tool:

script.Parent.Activated:Connect(function()
	local drinker = script.Parent.Parent.Humanoid
	drinker.BodyDepthScale.Value = 0.3
	drinker.BodyHeightScale.Value = 0.3
	drinker.BodyWidthScale.Value = 0.3
	drinker.HeadScale.Value = 0.3
	script.Parent.Parent.Humanoid.WalkSpeed = 25
	game.Workspace.Camera.FieldOfView = 20
end)

3 answers

Use RemoteEvents and they should be placed within a Folder in the tool. When the tool is activated, fire the RemoteEvent and change the size on the server.

Well, here you are using a Local Script so it will change it Client Sided. The simple solution is to fire a remoteevent to the Server.

-- Local Script
script.Parent.Activated:Connect(function()
    	local rs = game:GetService("ReplicatedStorage")
	local re = rs:FindFirstChild("RemoteEvent") -- Change the name to your RemoteEvent

    	local drinker = script.Parent.Parent.Humanoid

	re:FireServer(drinker)
end)

Now, we will set up the ServerScript and keep it in the ServerScriptService.

-- ServerScript
local rs = game:GetService("ReplicatedStorage")
local re = rs:FindFirstChild("RemoteEvent") -- Change the name to your RemoteEvent

local function Event(player, drinker) -- Creating a function
	drinker.BodyDepthScale.Value = 0.3
	drinker.BodyHeightScale.Value = 0.3
	drinker.BodyWidthScale.Value = 0.3
	drinker.HeadScale.Value = 0.3
	drinker.WalkSpeed = 25
	workspace.Camera.FieldOfView = 20
end

re.OnServerEvent:Connect(Event) -- Executes our function

Lemme know if it helps!

2 comments

0

I did this, and I got an error: BodyDepthScale is not a valid member of Player "Players.Dothemariobowp9"

0

I edited the script, and it might help! The problem was I haven't added a variable to index the info passed by the event.

It is currently impossible to get the player's character from a LocalScript!

This discussion is preserved as it was. New answers, comments, and votes are closed.