In this script, its connected to my datastore. This script is a local script inside the player's backpack. If the saved value of the weapon =1 or > then it gives them the weapon. However, if a player buys this in game, I dont want them having 2 of them. I want it to check and see if the player has this item in there startergear, and if they do it will destroy the script. But if it doesnt it will move along and continue the script.
Here is the script:
wait(10) local player = game.Players.LocalPlayer local playerChar = player.Character --Just incase I needed it :p if player.Tools.HighJump.Value == 0 then script:Destroy() elseif player.Tools.HighJump.Value >= 1 then print'Player Has HighJump' game.Lighting.HighJump:clone().Parent = player.StarterGear game.Lighting.HighJump:clone().Parent = player.Backpack end
EDIT INFO: The reason it is player.Tools.HighJump is because the 'Tools' is a model inside the player. And the 'HighJump' Is an int value. If this int value is saved as 1 from my data store, then the player will receive the ability they purchased. If the int value is 0 then that means they have not purchased it.
Just add this before your first if statment if player.StarterGear.Highjump =~ nil then script:Destroy
Also in this line of code if player.Tools.HighJump.Value == 0 then did you make it so tools is something inside of player? Normally players only have Backpack Startergear and Playergui from my testing.