Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Strength is not a valid member of IntValue "Players.ghgg471.leaderstats.Strength" how to fix?

i tried to make this code give me 1 strength when i right click using a tool and a lot of web surfing

local tool = script.Parent
local Player = tool.Parent.Parent
local leaderstat = Player.leaderstats.Strength

tool.Activated:Connect(function()
	leaderstat.Strength.Value = leaderstat.Strength.Value + 1
end)

this some how worked

local part = script.Parent

local click = part.ClickDetector



local function explode(Player)
	
	Player.leaderstats.Strength.Value = Player.leaderstats.Strength.Value -1	
	local explosion = Instance.new("Explosion")
	explosion.Parent = part   
	explosion.Position = part.Position
end



click.MouseClick:Connect(explode)

this explodes a block on touch but dosent destroy it and gives -1 point instead of destroying i dont want it to destry pls answer the above one here how i made the strength leader stats local function

local function OnPlayerJoin(Player)
	local leaderstats = Instance.new('Folder')
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player
	
	local Strength = Instance.new('IntValue')
	Strength.Name = 'Strength'
	Strength.Value = 1
	Strength.Parent = leaderstats
end

game.Players.PlayerAdded:Connect(OnPlayerJoin)

2 comments

0

It's okay we're here to help people with errors. some people request for scripts which is not the purpose of this website

0

thx

1 answer

✓ Accepted answer

In line 3 you referred leaderstats with strength. So just remove the 'Strength' in the first script at the end of line 3 and nothing else. like this:

local leaderstat = Player.leaderstats
-- and not
local leaderstat = Player.leaderstats.Strength -- you're referring to the integer value AKA int value

also if you get an error like this you're referring to a child of an instance that doesn't exist

2 comments

0

thx

0

im so dumb

This discussion is preserved as it was. New answers, comments, and votes are closed.