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

How can you get the character like how you could in a model?

Asked by 7 years ago

I want to get the character but when i do game.Players.LocalPlayers (in a LocalScript) and at the pop up for the local players, nothing comes up. Is it a function? I doubt it tho but can you tell me?

Also i want to move a gear to the players' backpack, you know what i mean right? And when i try doing:

game.StarterPack:ClearAllChildren() --There's another gear in the starter pack.
game.ServerStorage.AK74m:Clone()
game.ServerStorage.AK74m.Parent = game.StarterPack

i did that and in game.ServerStorage.AK74m.Parent = game.StarterPack and one, Well it went to the starterpack and it looked like it would switch gears in-game, but it didn't. It dis in the explorer while playing, but not in-game. And i thought well maybe i should move it to the players backpack, but apparently there's no way to put it in the players' backpack because i don't know HOW to. And the AK47m model didn't duplicate... e.e

please tell me how thank you!

0
local AK47m = game.ServerStorage.AK74m:Clone() local Player = game.Players.LocalPlayer Player.Backpack:ClearAllChildren() AK47m.Parent = Player.Backpack User#2146 0 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago
local player = game.Players.LocalPlayer
local Character = player.Character
local Backpack = player.Backpack

game.StarterPack:ClearAllChildren() --this will remove everything for every player, so I don't recommend doing this, it only makes changes after the player has died
--you could use
player.Backpack:ClearAllChildren() -- this removes the stuff in the players backpack but only in the current player, if you want to do it so it does it for every player use a for loop

--put ak74m in ReplicatedStorage
local ak47m = game.ReplicatedStorage.ak47m:Clone()
ak47m.Parent = Backpack

hope i helped

0
Thar didn't work! But idk why those didn't work! Chez_Guy 67 — 7y
0
put a one second wait at the start and try it as a normal script and local script :) abnotaddable 920 — 7y
1
also make sure ak is in replicatedstorage abnotaddable 920 — 7y
Ad
Log in to vote
-1
Answered by 7 years ago

If you are trying to reach a player you simply would do what you said "game.Players.LocalPlayer" and when you clone an object to a players backpack you want to access it with .Backpack.

local player = game.Players.Localplayer --This references the localplayer



game.StartPack:ClearAllChiildren()
game.ServerStorage.Ak74m:Clone()
game.ServerStorage.Ak74m.Parent = player.Backpack-- reference to the players backpack
0
That didn't work..so i cant accept your answer! Sorry Chez_Guy 67 — 7y
0
It is not supposed to work, Its not a fixed script, I'm simply telling you how to reference the localplayer and reference their backpack :) so yeah. GuestRealization 102 — 7y

Answer this question