So im not the best scripter but i tried rewriting this 2 times still same error
I started working on game on roblox and i needed this script to work for me to go forward in project.
Got stuck on this script which is called Activated, it tool script for it to fire event when tool is activated, please note the script is not finished that why there are blank functions
Here is script:
local replicatedStorage = game:GetService("ReplicatedStorage")
local Shared = replicatedStorage:WaitForChild("Shared")|
local Remotes = Shared:WaitForChild("Remotes")
local sword = script.Parent
local function activated()
Remotes.On_Tool_Activation:FireServer() |
end
local function equipped()
print("Function_Equipped:Function not finished")
end
local function unequipped()
print("Function_Unquipped:Function not finished")
end
sword.Equipped:Connect(equipped)
sword.Unequipped:Connect(unequipped)
sword.Activated:ClearAllChildren(activated)
Game output bellow
02:45:35.195 ClearAllChildren is not a valid member of RBXScriptSignal - Client - Activated:20
02:45:35.196 Stack Begin - Studio
02:45:35.196 Script 'Players.RexPROGaming09.Backpack.SpartanSword.Activated', Line 20 - Studio - Activated:20
02:45:35.196 Stack End - Studio
- UPDATED -
This is from a tutorial on youtube becuse im training for making games solo I dont know much about script but here explaination
So there are 2 values in the sword and this localscript which makes error Localscript is called activated and it connected to modulescript called RemoteController. When user holds sword in hand and clicks it localscript will activate function and event here is other script
local Players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local Shared = replicatedStorage:WaitForChild("Shared")
local Remotes = Shared:WaitForChild("Remotes")
local remoteController = {}
local cooldownTable = {}
function remoteController.OnToolActivation(player)
local currency = "Strenght"
local character = player.Character or nil
if character ~= nil then
local tool = character:FindFirstChildOfClass("Tool") or nil
if tool ~= nil then
local amount = tool.Amount.Value
local cooldown = tool.Cooldown.Value
if not cooldownTable[player.Name] then
cooldownTable[player.Name] = true
player.leaderstats[currency].Value += amount
wait(cooldown)
cooldownTable[player.Name] = false
end
end
end
end
Remotes.On_Tool_Activation.OnServerEvent:Connect(remoteController.OnToolActivation)
Players.PlayerRemoving:Connect(function(player)
if cooldownTable[player.Name] then
cooldownTable[player.Name] = nil
end
end)
return remoteController
And this script will add values from tool to player. This specific tool has strenght amount of 2 so it should be supposed to add player leaderstats 2 strenght. If you can help me tnx.

1 comment
Edited post for more info check under -Updated