I think its because of "LocalPlayer" but I am not sure. I am trying to move the TarantulaPet to the players character folder.
01 | local gamePassID = 0000000 |
02 | local function onPlayerAdded(player) |
03 |
04 | local hasPass = false |
05 |
06 | local success, message = pcall ( function () |
07 | hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) |
08 | end ) |
09 |
10 | if not success then |
11 | warn( "Error while checking if player has pass: " .. tostring (message)) |
12 | return |
13 | end |
14 |
15 | if hasPass = = true then |
You don't need to use game.Players.LocalPlayer.Character
, because the CharacterAdded
event has the character
argument passed in already. Even then, this should be a server script, so you can't use LocalPlayer in a server script.
1 | if hasPass then -- you don't need == true |
2 | player.CharacterAdded:Connect( function (character) -- change connect to Connect |
3 | game.ServerStorage:FindFirstChild( "TarantulaPet" ):Clone().Parent = character |
4 | end ) |
5 | end |
Hope this helps! :)