Firstly, you should ensure your references to property names are correct, otherwise your code will throw an error. If the references to the objects in your code are correct, the following should work:
local label = script.Parent.Parent.TextLabel
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() -- wait for the player's character to load
script.Parent.MouseButton1Click:Connect(function()
character.Humanoid.WalkSpeed += 1 -- increase the walkspeed by 1
label.Text = tostring(character.Humanoid.WalkSpeed) -- set the text of the label to the walkspeed
end)
local id = --gamepass id here
game.Players.PlayerAdded:Connect(function(player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then
--code here
end
end
I would usually use a remote for things like this though I’m honestly unsure if it’s necessary in this scenario because you can make modifications to the player’s character on the client and it will replicate to the server. Not really sure what’s better - setting it using a remote or setting it from the client, though I know it’s an important practice not to trust the client so I’d go with the solution of updating the WalkSpeed on the server.