Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
OFF_S4LE 127
4 years ago
Edited 4 years ago

y error:: - Workspace.tool.Script:3: attempt to call a RBXScriptSignal value

scrip in toool:

1while true do
2wait(1)
3local Players = game:GetService("Players")
4local tool = game.Workspace.tool
5tool.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:

1while true do
2wait(1)
3local Players = game:GetService("Players")
4local tool = game.Workspace.tool
5tool.Activated(function()
6        local Money = Players.leaderstats.TIX
7        local Money = Players.leaderstats.TIX
8        Money.Value += 1
9    end)

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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
2local tool = script.Parent
3 
4tool.Activated:connect(function() -- bruh do u even know how to connect functions??
5local plr = game.Players:GetPlayerFromCharacter(tool.Parent) -- this how u get player actual way
6local Money = plr.leaderstats.TIX -- select it once bruh
7Money.Value = Money.Value + 1 -- use ur brain
8end)
0
no u OFF_S4LE 127 — 4y
0
:connect is deprecated Leamir 3138 — 4y
Ad
Log in to vote
1
Answered by
Leamir 3138 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

hello, OFF_S4LE!

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

1-- no loop needed
2local tool = script.Parent --As you told me at ScriptingHelpers chat, tool is scripts's parent
3 
4tool.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
9end)
0
hold on did u just copy my script or do we both realize the simple answer TheUltimateTNTFriend 109 — 4y
0
I am chatting with OFF_S4LE at the website chat, I was writting mine when you posted yours Leamir 3138 — 4y
0
but i answered first :( TheUltimateTNTFriend 109 — 4y
0
also can u help me with my question? it very confusing TheUltimateTNTFriend 109 — 4y

Answer this question