I am making this button for my obby that will essentially change the player's HumanoidRigType to R15 or R6. (In case some people prefer R15, etc.)

When the HumanoidRigType changes, it just kills the player and reverts to the HumanoidRigType that the player just had, rather than changing it.

I assumed that I'd need a ServerScript to change a player's HumanoidRigType, so I whipped up a quick RemoteEvent that I can call via my LocalScript.

The location of the script is in a Gui in ScreenGui (in StarterGui), (which if you didn't know) transfers to a player's PlayerGui after they join.

Below is the script:

-- Variables:

local eventsFolder = game:GetService('ReplicatedStorage').RemoteEvents
local changeRigTypeEvent = eventsFolder:WaitForChild('ChangeHumanoidRigType')
local freezePlayerToggleEvent = eventsFolder:WaitForChild('FreezePlayerToggle')

local AreYouSure = script.Parent.AreYouSure
local Button = script.Parent.Button
local LRCTextLabel = script.Parent.LoadingRigChange

-- Tweening Function:

local function tweenAreYouSure(inout)
	if inout == 'in' then
		AreYouSure:TweenPosition(UDim2.new(0.319,0,0.285,0), "In", "Bounce", 1)
	elseif inout == 'out' then
		AreYouSure:TweenPosition(UDim2.new(0.319, 0, 1.05, 0), "Out", "Bounce", 1)
	end
end

-- OnClicked Functions:

local function onClicked1()
	freezePlayerToggleEvent:FireServer('on')
	for i = 10, 1, -1 do
		wait(0.05)
		Button.ImageTransparency = Button.ImageTransparency + .1
		Button.TextLabel.TextTransparency = Button.TextLabel.TextTransparency + 0.1
	end
	Button.Visible = false
	tweenAreYouSure('in')
end

local function onClicked2() --cancel
	tweenAreYouSure('out')
	Button.Visible = true
	for i = 10, 1, -1 do
		wait(0.05)
		Button.ImageTransparency = Button.ImageTransparency - 0.1
		Button.TextLabel.TextTransparency = Button.TextLabel.TextTransparency - 0.1
	end
	freezePlayerToggleEvent:FireServer('off')
end

local function onClicked3() --change rig type
	local loadingTime1 = math.random(1,8)
	print('The loading cycle will repeat '..loadingTime1..' time(s)')
	tweenAreYouSure('out')
	LRCTextLabel:TweenPosition(UDim2.new(0.046, 0, 0.408, 0), "In", "Linear", 0.25)
	for i = loadingTime1, 1, -1 do
		LRCTextLabel.Text = 'Loading'
		LRCTextLabel.Text = 'Loading.'
		LRCTextLabel.Text = 'Loading..'
		LRCTextLabel.Text = 'Loading...'
	end
	changeRigTypeEvent:FireServer() -- where it calls the event
end

-- Calling onClicked Functions:
Button.MouseButton1Click:Connect(onClicked1)
AreYouSure.Cancel.MouseButton1Click:Connect(onClicked2)
AreYouSure.Yes.MouseButton1Click:Connect(onClicked3)

Please note that everything works except for changing the player's HumanoidRigType.

Below is the script that is receiving the event that changed the humanoid's RigType:

(ignore the freeze toggle it's for something else)

-- Variables:
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local EventsFolder = ReplicatedStorage:WaitForChild('RemoteEvents')

-- Event Functions:

function changePlayerRigType(player) --function that changes rig type
	local humanoid = player.Character.Humanoid
	if humanoid.RigType ~= Enum.HumanoidRigType.R15 then
		humanoid.RigType = Enum.HumanoidRigType.R15
	elseif humanoid.RigType ~= Enum.HumanoidRigType.R6 then
		humanoid.RigType = Enum.HumanoidRigType.R6
	end
end

function freezeToggle(player, onOff)
	if onOff == 'off' then
		player.Character.Humanoid.JumpPower = 50
		player.Character.WalkSpeed = 16
	elseif onOff == 'on' then
		player.Character.Humanoid.JumpPower = 0
		player.Character.Humanoid.WalkSpeed = 0
	else
		warn('Something is wrong with data being transferred to the event.')
	end
end

-- Calling Events:

EventsFolder.ChangeHumanoidRigType.OnServerEvent:Connect(changePlayerRigType)
EventsFolder.FreezePlayerToggle.OnServerEvent:Connect(freezeToggle)

I looked on Google before posting this question, and it seems as other people are also wanting answers for this! Thanks for helping.