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

Why the error? This script issupposed to give 1 leaderstat when the tool is equippedand gets clicked

y error::

  • Workspace.tool.Script:3: attempt to call a RBXScriptSignal value

scrip in toool:

while true do
wait(1)
local Players = game:GetService("Players")
local tool = game.Workspace.tool
tool.Activated(function()
		local Money = Players.leaderstats.TIX
		local Money = Players.leaderstats.TIX
        Money.Value += 1
	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:

while true do
wait(1)
local Players = game:GetService("Players")
local tool = game.Workspace.tool
tool.Activated(function()
		local Money = Players.leaderstats.TIX
		local Money = Players.leaderstats.TIX
        Money.Value += 1
	end)

2 answers

✓ Accepted answer

dude here is the fixed script.. u so dum and put the script inside the tool doofus

-- u dont need a damn while true do
local tool = script.Parent

tool.Activated:connect(function() -- bruh do u even know how to connect functions??
local plr = game.Players:GetPlayerFromCharacter(tool.Parent) -- this how u get player actual way
local Money = plr.leaderstats.TIX -- select it once bruh
Money.Value = Money.Value + 1 -- use ur brain
end)

2 comments

0

no u

0

:connect is deprecated

hello, OFF_S4LE!

I made this answer based on what we chatted on the Website Chat

-- no loop needed
local tool = script.Parent --As you told me at ScriptingHelpers chat, tool is scripts's parent

tool.Activated:Connect(function()
	local Player = game.Players:GetPlayerFromCharacter(tool.Parent) -- Define player based on character
	local Money = Player.leaderstats.TIX
        --You dont need to define the variable 2 times
        Money.Value =  Money.Value + 1 -- += don't exists in lua
end)

4 comments

0

hold on did u just copy my script or do we both realize the simple answer

0

I am chatting with OFF_S4LE at the website chat, I was writting mine when you posted yours

0

but i answered first :(

0

also can u help me with my question? it very confusing

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