This script is fired when the player clicks the exit button on a shop. This script for some reason doesn't change the player's walkspeed
game.ReplicatedStorage.CloseShop.OnServerEvent:Connect(function(player) game.Workspace[player.Name].HumanoidRootPart.CFrame=game.Workspace.SHOP.ExitShopPart.CFrame game.Workspace:FindFirstChild(player.Name).Humanoid.WalkSpeed = 16 end)
And whats weird is that if I change this value to 17 or 15 it changes. Why is it doing this?
Okay, so if anybody gets this same problem I found the fix.
What i did to combat this problem was that I made a remote event which was fired when the player closed the shop.
Script
game.ReplicatedStorage.CloseShop.OnServerEvent:Connect(function(player) game.Workspace[player.Name].HumanoidRootPart.CFrame=game.Workspace.SHOP.ExitShopPart.CFrame game.ReplicatedStorage.SetSpeed:FireClient(player) -- the remote event that was fired end)
Then, I had a local script listening for the remote event. When the event was fired, this script set the player's walkspeed to 16
Local script
local replicatedStorage = game:GetService("ReplicatedStorage") replicatedStorage.SetSpeed.OnClientEvent:Connect(function() game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 end)
I still have no idea why my script didn't like to change the walkspeed to 16 but this is the fix!