Problem with startergear

  1. What do you want to achieve?
    i made a script event thing that gives the player a tool when they give cash
    since i dont want the tool to deletes itself when the player dies/respawns, i added a line to clone the tool and parent it to startergear
game:GetService("ReplicatedStorage").vortexOrbTool:Clone().Parent = player.StarterGear
  1. What is the issue?
    the script works perfectly fine until the player dies. The player’s startergear’s tool doesnt inserts it into the players backpack.

heres a picture of the player’s backpack/startergear:
before death
https://gyazo.com/a24edc457b77672db36d65b1eefa1da9
after death
https://gyazo.com/941728a3ed416b3ec1e2b64829e23a0f

  1. What solutions have you tried so far?
    i tried to check my lines, change the syntax, searched on devofrum for a very long time but i can’t solve the problem.

Have you tried putting the line of code into ReplicatedStorage?

i tried to. the script just doesn’t work at all.

Edit: also, the script is in startergui, idk if it’s the right place for it to run properly

What is the gear you are using called?

i didn’t give it a special name when cloned, it’s just “vortexOrbTool”

Are you sure there’s nothing inside the backpack? The tool might just not show up in your inventory.

To instantly give a player a tool, you should clone it into both the player’s Backpack and StarterGear.
To remove it, just delete the tool from both locations.

yeah there’s nothing inside the backpack, i inserted another part of the code inside the post but it didn’t show up somehow.

game:GetService(ReplicatedStorage).vortexOrbTool:Clone().Parent = player.Backpack
game:GetService(ReplicatedStorage).vortexOrbTool:Clone().Parent = player.StarterGear

Try this maybe?
game:GetService(“ReplicatedStorage”).Clone().Parent = spawn(vortexOrbTool).StarterGear

i tried, but now, the tool doesn’t appear in the player’s startergear

game:GetService(“ReplicatedStorage”).Clone().Parent = spawn.StarterGear == “vortexOrbTool”

while “vortexOrbTool” == spawn(true) do

script.parent.Humanoid.Maxhealth = 0 do

game:GetService(“ReplicatedStorage”).Clone().require() false

end

end

end

end

Doesn’t work, it says
Expected identifier when parsing expression, got 'false'
in the ouput

It’d be helpful if we could see your full-on script that handles all of the cloning, and checking if they have enough Cash or not

And a slight nitpick but do try to reference your Services first, instead of calling game:GetService() every time you use one, it’ll save you less effort

i dont know if this is going to help because my script looks really messed up since i dont really know how to code

alright so basically i have this remoteevent which fires the serverwhen proximityprompt is triggered
the script is a localscript btw

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEventServer = replicatedStorage:WaitForChild("buyVortexOrb")

proximityPrompt.Triggered:Connect(function()
remoteEventServer:FireServer()
end)

and then i have a normal script which fires another remoteevent to fire the client

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEventServer = replicatedStorage:WaitForChild("buyVortexOrb")
local remoteEventClient = replicatedStorage:WaitForChild("buyVortexOrb"):WaitForChild("fireClient")

remoteEventServer.OnServerEvent:Connect(function(player)
	remoteEventClient:FireClient(player)
end)

and then i have a last localscript which runs the action when the client is fired

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEventServer = replicatedStorage:WaitForChild("buyVortexOrb")
local remoteEventOnClient = replicatedStorage:WaitForChild("buyVortexOrb"):WaitForChild("fireClient")

local proximityPrompt = workspace:WaitForChild("vortexOrbGiver"):WaitForChild("toolGiver"):WaitForChild("Attachment"):WaitForChild("ProximityPrompt")

local debounce = false

remoteEventOnClient.OnClientEvent:Connect(function(player)
	if debounce == false then
		debounce = true
		local player = game:GetService("Players").LocalPlayer
		local leaderstats = player.leaderstats
		local RoTokens = leaderstats:WaitForChild("RoTokens")
		local check = player.Backpack:FindFirstChild("vortexOrbTool")
		if not check then
			if RoTokens.Value >= 1000000 then
				RoTokens.Value = RoTokens.Value - 1000000
				game:GetService("ReplicatedStorage").vortexOrbTool:Clone().Parent = player.Backpack
				game:GetService("ReplicatedStorage").vortexOrbTool:Clone().Parent = player.StarterGear
			else
				if RoTokens.Value <= 1000000 then
					local notEnoughTokens = player:WaitForChild('PlayerGui'):WaitForChild("StarterGUI"):WaitForChild("mainGUI"):WaitForChild("notEnoughTokens")
					notEnoughTokens.Transparency = 0
					notEnoughTokens.Visible = true

					local ts = game:GetService("TweenService")
					local goalBG = {
						BackgroundTransparency = 1
					}
					local goalT = {
						TextTransparency = 1
					}
					local tweenInfo = TweenInfo.new(1,Enum.EasingStyle.Exponential,Enum.EasingDirection.In)
					wait(0.5)
					local tweenBG = ts:Create(notEnoughTokens, tweenInfo, goalBG)
					local tweenText = ts:Create(notEnoughTokens, tweenInfo, goalT)
					tweenBG:Play()
					tweenText:Play()
					wait(1)
					notEnoughTokens.Visible = false
				end
			end
		else
			if check then
				local alreadyHas = player:WaitForChild('PlayerGui'):WaitForChild("StarterGUI"):WaitForChild("mainGUI"):WaitForChild("notEnoughTokens"):Clone()
				alreadyHas.Parent = player.PlayerGui.StarterGUI.mainGUI
				alreadyHas.Name = "alreadyHasGUI"
				alreadyHas.Text = "❗You already own Vortex Orb❗"
				alreadyHas.BackgroundTransparency = 0
				alreadyHas.TextTransparency = 0
				alreadyHas.Visible = true

				local ts = game:GetService("TweenService")
				local goalBG = {
					BackgroundTransparency = 1
				}
				local goalT = {
					TextTransparency = 1
				}
				local tweenInfo = TweenInfo.new(1,Enum.EasingStyle.Exponential,Enum.EasingDirection.In)
				wait(0.5)
				local tweenBG = ts:Create(alreadyHas, tweenInfo, goalBG)
				local tweenText = ts:Create(alreadyHas, tweenInfo, goalT)
				tweenBG:Play()
				tweenText:Play()
				wait(1)
				alreadyHas.Visible = false
			end
		end
		debounce = false
	end
end)

sorry if it’s not understandable

That’s more than likely why, whenever you clone Tools and attempt to put them inside the Player’s Backpack/StarterGear from the client side, it just works extremely wonky and unstable

Unless if you have like custom functions within the Tool that you’d like to activate within the Client side, just handle it on the server instead so that the Tool can properly function right & clone within the Player’s StarterGear/Backpack

You can handle effects on the client though, that’ll be completely fine if you want it to work smoothly but make sure to properly handle Tool Cloning on the Server first

1 Like