So i made a flashlight, and been wondering how do i make it spawn with you cause my game backpack is disabled.
You can use [Flashlight here]:Clone()
to clone the flashlight. You will need to parent this to the player’s StarterGear if you want them to spawn with the flashlight at all times.
the flashlight is in Starterpack so i create a local script and wrote Flashlight:Clone()
You want to make this script outside of Starterpack, if it’s inside the gear inside Starterpack, the script inside it will not work.
So, i have to put it in workspace?
wrong post, so sorry
e
eeee
If it’s a script, Workspace
could work, but preferably ServerScriptService
. If it’s a local script, you should put it in StarterPlayerScripts
Thanks, where do i put the gear?
script.Flashlight:Clone()
would work?
The cloning script should be outside of the flashlight gear in order for it to work.
game.Starterplayerscripts.Flashlight:Clone()
@Dragonfable6000 the gear is on starterplayer and the script is on workspace and the code is: game.StarterPlayer.StarterPlayerScripts.Flashlight:Clone()
it will duplicate it but in starterplayer
Generally if you want to clone something that doesn’t exist in the game, you should have the flashlight be in ReplicatedStorage
The flashlight stuff.
backpack coregui is disabled and the player spawns with it on the hand.
the script is on workspace the flashlight is on replicated storage
the code is game.ReplicatedStorage.Flashlight:Clone()
All tools in starterpack go to the players backpack, you can just do use the Players.PlayerAdded
, wait for the tool to get cloned into the backpack and move it into the character or use Humanoid:EquipTool(player.Backpack.Flashlight)
Should look something like this.
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
local backpack = player.Backpack
repeat task.wait() until backpack:FindFirstChild("Flashlight")
local character = player.Character or player.CharacterAdded:Wait()
backpack.Flashlight.Parent = character
end)
can be placed in serverscriptservice
Where does the flashlight has to be placed?
The flashlight can be placed in StarterPack
Alright thank you, if it works ill give you a solution.
sorry for bumping, but I recommend using a variable to clone the flashlight, you might encounter some issues when trying certain things