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:

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

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

-- 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)
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

-- 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)
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