Server Script only working for the last player to join the server

  1. What do you want to achieve? Keep it simple and clear!
    Inventory script
  2. 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
  3. 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)
1 Like

First script isn’t local script? Can you please make photos/videos?
Try move first script to Server Script Service or workspace

the first script is a server script and does not fix the issue whether in SSS or workspace

oh change Character to player.Character

i did this before i posted and it still had the same outcome?

can you send map to me? I will fix fast

what does you mean by a map? like workspace?

Yes. With code and remote event
P.S: You can post right here

2.rbxl (63.9 KB)
MY BAD
i didnt include everything so nothing can be stolen

the local script is in the Button

this what you wanted???Waterattackkkk.rbxl (63.6 KB)

Yes this is it thanks man][#';