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

A localscript in a tool doesnt know a local i made in serverscriptservice?

hi everyone, so i made this click-detector, but it wont add points. This script is in a normal script in serverscriptservice:

game.Players.PlayerAdded:Connect(function(player)
	print("LeaderStats")
	local stats = Instance.new('IntValue', player)
	stats.Name = 'stats'
			
	print("Stats")
	local IQ = Instance.new("IntValue", stats)
	IQ.Name = "IQ"
	IQ.Value = 0
end)

This is a script inside of a tool in the starterpack:

script.Parent.Parent.Equipped:Connect(function(mouse)
    mouse.Button1Down:Connect(function()
        print ("clicked")
		IQ.Value = IQ.Value + 1
    end)
end)

In the output it says that IQ is not defined... how do i allow the localscript to use a local from the serverscriptservice?

1 answer

Read up on more lua. The way I’ll do it is create an IntValue that represents the leaderboard stat and that value has to be somewhere parented under player so you can get it. Also since it’s FE you cannot change anything within a localscript so make a RemoteFunction to do that

1 comment

0

its litterally a intvalue in the player already wth

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