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
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.
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.
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)
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