y error:: - Workspace.tool.Script:3: attempt to call a RBXScriptSignal value
scrip in toool:
1 | while true do |
2 | wait( 1 ) |
3 | local Players = game:GetService( "Players" ) |
4 | local tool = game.Workspace.tool |
5 | tool.Activated( function () |
6 | local Money = Players.leaderstats.TIX |
7 | local Money = Players.leaderstats.TIX |
8 | Money.Value + = 1 |
9 | end ) |
translation: Why the error? This script is supposed to give 1 leaderstat when the tool is equipped and gets clicked
The error:
Workspace.tool.Script:3: attempt to call a RBXScriptSignal value
Script:
1 | while true do |
2 | wait( 1 ) |
3 | local Players = game:GetService( "Players" ) |
4 | local tool = game.Workspace.tool |
5 | tool.Activated( function () |
6 | local Money = Players.leaderstats.TIX |
7 | local Money = Players.leaderstats.TIX |
8 | Money.Value + = 1 |
9 | end ) |
dude here is the fixed script.. u so dum and put the script inside the tool doofus
1 | -- u dont need a damn while true do |
2 | local tool = script.Parent |
3 |
4 | tool.Activated:connect( function () -- bruh do u even know how to connect functions?? |
5 | local plr = game.Players:GetPlayerFromCharacter(tool.Parent) -- this how u get player actual way |
6 | local Money = plr.leaderstats.TIX -- select it once bruh |
7 | Money.Value = Money.Value + 1 -- use ur brain |
8 | end ) |
hello, OFF_S4LE!
I made this answer based on what we chatted on the Website Chat
1 | -- no loop needed |
2 | local tool = script.Parent --As you told me at ScriptingHelpers chat, tool is scripts's parent |
3 |
4 | tool.Activated:Connect( function () |
5 | local Player = game.Players:GetPlayerFromCharacter(tool.Parent) -- Define player based on character |
6 | local Money = Player.leaderstats.TIX |
7 | --You dont need to define the variable 2 times |
8 | Money.Value = Money.Value + 1 -- += don't exists in lua |
9 | end ) |