Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is there an alternative to PlayerOwnsAsset that does not require the user to rejoin the game?

Asked by 3 years ago

So I'm making a self check in thing, and I want to make sure people can't fire a remote and get business class for free if they really wanted to, so I just added the following line of code; elseif MS:PlayerOwnsAsset(Player, class3shirt) then, not sure if it's a formatting issue or something so I'll show you my entire section of the script.

    elseif classes == 3 then
    elseif MS:PlayerOwnsAsset(Player, class3shirt) then
Player.Character.Humanoid.DisplayName = Player.Name..' | Big Front Seat'
local card3clone = card3:Clone()
        card3clone.Parent = Player.Backpack
warn('SCI -->> '..Player.Name..' checked into Big Front Seat')

end -->> I think these are from something else I'm not sure.
end     

So I tested it by entering the following code into the local command line; local revent = game.ReplicatedStorage:WaitForChild('class') revent:FireServer(3), sure enough this did not work, but then I tried to check myself in with the system itself, but it didn't work, I'm assuming this is an updating issue, but it could be formatting like I said, how do I fix this?

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

This is your version:

elseif classes == 3 then
elseif MS:PlayerOwnsAsset(Player, class3shirt) then
Player.Character.Humanoid.DisplayName = Player.Name..' | Big Front Seat'
local card3clone = card3:Clone()
    card3clone.Parent = Player.Backpack
warn('SCI -->> '..Player.Name..' checked into Big Front Seat')

end -->> I think these are from something else I'm not sure.
end    

It should be this:

if classes == 3 then
if MS:PlayerOwnsAsset(Player, class3shirt) then
Player.Character.Humanoid.DisplayName = Player.Name..' | Big Front Seat'
local card3clone = card3:Clone()
    card3clone.Parent = Player.Backpack
warn('SCI -->> '..Player.Name..' checked into Big Front Seat')

end -->> I think these are from something else I'm not sure.
end      

I think it will work-yours didn't since you wrote elseif, that means if else so to make it work, I think if will work instead.

Ad

Answer this question