#Random Gear Given on Teleport

1 messages · Page 1 of 1 (latest)

lime nymph
#

New to scripting and just can't figure out how this works.
I have 3 gears in the StarterPack all as children of a Script. Here's my current code:

local gun = game.StarterPack.Script.HyperlaserGun
local squid = game.StarterPack.Script.SquidGun
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local player = game.Players.LocalPlayer

InRound.Changed:Connect(function()
    if InRound.Value == true then
        sword.Parent = player.Backpack
    else
        sword.Parent = game.StarterPack.Script
        gun.Parent = game.StarterPack.Script
        squid.Parent = game.StarterPack.Script
    end
end)```

and it won't work. I added print statements to let me know if the code is being read. I'm getting the statements fine, but not the gears. Any ideas?
last gust
#

the gears should be directly on the starter pack, puting the script on the starter pack only makes the script go to the backpack

lime nymph
#

if i put them in starterpack then i get all 3 on first spawn

last gust
#

and after the game starts nothing will go into the backpack

dire crowBOT
#

studio** You are now Level 2! **studio

last gust
#

that only activates when loading character

#

u need to directly put them on the backpack

#

not the starter pack

lime nymph
#

how do i do that??

last gust
#

tool.Parent = game:GetService("Players").(whaterver player u want).Backpack

lime nymph
#

where should i put the gears if not starterpack

#

like where do i place them

last gust
#

replicated storage or serverstorage

last gust
lime nymph
#

trying that rn

lime nymph
#

or would i use the serverstorage for that

lime nymph
#

no

#

normal script

last gust
#

local player doesnt work on a server script

last gust
lime nymph
#

ohh alr

lime nymph
last gust
#

for name, player in game:GetPlayers() do
tool.Parent = game:GetService("Players").player.Backpack
end

#

ts should work

lime nymph
#

did i insert it right

lime nymph
last gust
#

uhhh

#

ohh

#

sorry

#

mb

#

its game:GetService("Players"):GetPlayers()

lime nymph
#

alr now i think ive done smth wrong

#

bcz its saying player is not a valid member of Players "Players"

last gust
#

oh

#

uh

#

i didnt notice that

#

mb part 2

#

on the line that you do

#

tool.Parent = game:GetService("Players").player.Backpack

#

it should be just

#

tool.Parent = player.Backpack

#

bc the for loop gives back the player already

#

DAMN bro

#

how can i do ts

#

😭

lime nymph
#

no bro its definetely me i keep getting more errors 😭

#

your code becomes cursed when i view it gng

last gust
#

i wrote everything right on the roblox studio but i wrote everything wrong on discord

last gust
lime nymph
#

Players.DaMathBoii_YT.Backpack.Script:11: attempt to index nil with 'Parent'

last gust
#

oh yeah i didnt explain that

#

the "tool" on the script should be replaced with the tool that you want to give the player

last gust
lime nymph
#

yeah i did

#

omg

#

i forgot to change it back

#

kmss

#

YESS

#

IT WORKS

last gust
#

🔥

lime nymph
#

thank you bro ❤️

coarse sentinel
last gust
#

i said that

#

like

#

to messages below

coarse sentinel
#

oh sorry

last gust
#

two*

coarse sentinel
#

i just saw this