Hello again. I'm having trouble with a RemoteEvent. It involves a LocalScript inside an ImageButton and a server-side script inside ServerScriptService. The two scripts work perfectly in Studio's Play mode, but not in-game. Here's the two scripts.
Local script:
local storage = game:GetService("ReplicatedStorage")
local remote = storage.ShrinkRemote
local plr = game.Players.LocalPlayer
local button = script.Parent
local value = plr.PlayerGui.ScreenGui.ScaleValue
button.MouseButton1Click:Connect(function()
if button.Image == "rbxassetid://2310019779" then
if value.Value == false then
print("Shrink button fire!")
value.Value = true
remote:FireServer()
end
end
end)
And the server script:
local storage = game:GetService("ReplicatedStorage")
local remote = storage.ShrinkRemote
remote.OnServerEvent:connect(function(plr)
local chr = plr.Character
local size = plr.PlayerGui.ScreenGui.SizeValue
print("Shrink phase 2 reached!")
for i=0,50 do
size.Value = size.Value - 0.0137254902
chr.Humanoid.BodyDepthScale.Value = size.Value
chr.Humanoid.BodyHeightScale.Value = size.Value
chr.Humanoid.BodyWidthScale.Value = size.Value
chr.Humanoid.HeadScale.Value = size.Value
chr.Humanoid.WalkSpeed = chr.Humanoid.WalkSpeed - 0.196078431
chr.Humanoid.JumpPower = chr.Humanoid.JumpPower - 0.392156863
wait(0.005)
end
print("Shrinking was a success!")
end)
By looking at the printed text in the Developer Console, I can deduce that the LocalScript did in fact fire the RemoteEvent, but for whatever reason, the server-side script is not receiving it. The last print I get when pressing the button is "Shrink button fire!". Any help would be greatly appreciated. Thank you.

1 comment
connect is deprecated, use Connect.