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

When "Vividex" joins hat give won't work?

Asked by
Vividex 162
10 years ago
local JJ = game.ReplicatedStorage.JJ

function onEnter(player) end
    if (player).name == "Vividex" then do
        JJ.Parent = player
    end
end

this is probably no wear near to close of what i thought pretty much suck at scripting i put the jj hat in replicatedstorage and made a function when i join it takes the hat and puts it on me probably not even close lol please help? i also am trying to make it repeat on death

1 answer

Log in to vote
1
Answered by 10 years ago

Try this one:

local JJ = game.ReplicatedStorage.JJ

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        if player.Name == "Vividex" then
            JJ:Clone().Parent = player
        end
    end)
end)

You wrote a function in a script and as what tutorial says, the function is useless without being triggered. You must just write onEnter()for it to work.

The script I wrote has its event listener so that when the event occur, the function will too.

0
Nothing happens when I join the game:-( Vividex 162 — 10y
Ad

Answer this question