I was trying to make a walkspeed gamepass, but it did not work for some reason, is it because of FE on?
Here is the script [it's in ServerScriptService]
1 | game.Players.PlayerAdded:Connect( function (player) |
2 | player.CharacterAdded:Connect( function (character) |
3 | if game.MarketplaceService:PlayerOwnsAsset(player, 4865295 ) then |
4 | character.Humanoid.Walkspeed = 40 |
5 | end |
6 | end ) |
7 | end ) |
please someon help!
Here, your problem is: You used PlayerOwnsAsset
instead of using UserOwnsGamePassAsync
. Also consider using :GetService().
Here's the code:
01 | game.Players.PlayerAdded:Connect( function (player) |
02 |
03 | player.CharacterAdded:Connect( function (character) |
04 |
05 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(player.UserId, 4865295 ) then |
06 |
07 | character:WaitForChild( "Humanoid" ).WalkSpeed = 40 |
08 |
09 | end |
10 |
11 | end ) |
12 |
13 | end ) |
The gamepass would be fine as it is a script inserted by the server, FE does not allow changes to be made by the client, however this is server-sided, so it should work fine. I'm not the best in Studio, though, so you might have to look at some one else for confirmation. If I helped, please make sure to upvote! It helps me out. -Doge Master
You should use UserOwnsGamePassASync because if you use asset id, you mean like models, decals, shirts, etc.