i try to make like an survival game but i have one problem at this moment. I was making sticks to pickup on the ground like if you press E you get the stick in your inventory. But the amount of sticks in my game is showed in the leaderboard. i don't want it in my Inventory. so can somebody help me to adjust this script? in the short i just want to press E on the stick that the number of stick increase by 1. please help me with this..
here is my script:
local Can = true local rpl = game.ReplicatedStorage
script.Parent.Event.OnServerEvent:connect(function(Player) local Mag = (script.Parent.Center.Position-Player.Character.HumanoidRootPart.Position).magnitude if Mag <= script.Parent.Range.Value then if Can then Can = false if Player.Backpack:FindFirstChild("Stick") then
else
local keycard = game.ReplicatedStorage.Stick:Clone()
keycard.Parent = Player.Backpack
keycard.Name = "Stick"
script.Parent:Destroy()
Can = true
end
end
end
end)
BTW: here is my LeaderBoard script:
starting_Rocks = 2 starting_Sticks = 7 starting_Strings = 1 starting_Metal = 0
function onPlayerEntered(player) wait(1) --delay for loading time local leaderstats = Instance.new("IntValue") leaderstats.Parent = player leaderstats.Name = "leaderstats" local Rocks = Instance.new("IntValue") Rocks.Parent = leaderstats Rocks.Name = "Rocks" Rocks.Value = starting_Rocks local Sticks = Instance.new("IntValue") Sticks.Parent = leaderstats Sticks.Name = "Sticks" Sticks.Value = starting_Sticks local Strings = Instance.new("IntValue") Strings.Parent = leaderstats Strings.Name = "Strings" Strings.Value = starting_Strings local Metal = Instance.new("IntValue") Metal.Parent = leaderstats Metal.Name = "Metal" Metal.Value = starting_Metal end
game.Players.ChildAdded:connect(onPlayerEntered)

1 comment
You destroyed the script before can = true but as I am sick and sort of asleep I can’t tell if that would fix the issue