-
What do you want to achieve? Keep it simple and clear!
Inventory script -
What is the issue? Include screenshots / videos if possible!
Script works fine, problem is that when someone joins, the script will only work for that person that joins. Also, all the tools that are in the player’s backpack before the new player joins just turn invisible and cannot be accessed -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried putting it in StarterCharacterScripts but not successful
server script (in sss):
game.ReplicatedStorage.GiveToPlayer.OnServerEvent:Connect(function(player , power)
local Character = script.Parent
if player.Skill1.Value == false then
if player.Backpack:FindFirstChild("Skill1") then
player.Backpack:FindFirstChild("Skill1"):Destroy()
end
if Character:FindFirstChild("Skill1") then
Character:FindFirstChild("Skill1"):Destroy()
end
print("nil outcome, giving player tool")
local power = power
local powerr = power:Clone()
powerr.Parent = player.Backpack
player.Skill1.Value = true
elseif player.Skill1.Value == true then
local powerr = power:Clone()
print("Already owns tool, removing tool")
if player.Backpack:FindFirstChild("Skill1") then
player.Backpack:FindFirstChild("Skill1"):Destroy()
powerr.Parent = player.Backpack
end
if Character:FindFirstChild("Skill1") then
Character:FindFirstChild("Skill1"):Destroy()
powerr.Parent = player.Backpack
end
player.Skill1.Value = false
end
end)
the local script(in starter gui button):
local origintext = script.Parent.Text
local Player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local power = game.ReplicatedStorage.Water.Skill1
game.ReplicatedStorage.GiveToPlayer:FireServer(power)
end)