Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need a wait For Player to load script for gear?

I've been working on this script for a while now and it finally works, the only problem is that the player does not load in time, I've tried using wait but its not really working as it should be. Here is the code

--this is where i need it
local player = game.Players.LocalPlayer
 if player.Name == "flasebaglostthispass" or "Gabysarwono" or "Matthew14637" or "sally1234sally1234" or "Xxthexcos" or "Sabrna563" then
	game.ReplicatedStorage.Flashlight.Parent = player.Backpack
end

for proof that the script works (Without the timing) I used the command bar and it works. please help

1 answer

✓ Accepted answer

Not sure, I'm right, but you can't add something to a player's backpack using a local script.

Lucky, we could use FireServer. (make sure you add a remotevent to replicatedstorage) btw use clone instead

local RemoteEvent = game.ReplicatedStorage.RemoteEvent
local player = game.Players.LocalPlayer
 if player.Name == "flasebaglostthispass" or "Gabysarwono" or "Matthew14637" or "sally1234sally1234" or "Xxthexcos" or "Sabrna563" then
RemoteEvent:FireServer(player)
end

Server script inside of serverscriptservice:

local RemoteEvent = game.ReplicatedStorage.RemoteEvent
RemoteEvent.OnServerEvent:Connect(function(player)
 game.ReplicatedStorage.Flashlight:Clone().Parent = player.Backpack
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.