This script worked perfectly fine before, and I can’t recall adding anything different. The issue is that whenever I try to define the ‘Uses’ value it always turns out as in error.
SERVER SCRIPT:
local SSSEngineEvents = game:GetService("ServerScriptService").SSSEvents.Engine
local Engine1FixedEvent = SSSEngineEvents.Engine1Fixed
local Engine2FixedEvent = SSSEngineEvents.Engine2Fixed
local Engine3FixedEvent = SSSEngineEvents.Engine3Fixed
local Engine4FixedEvent = SSSEngineEvents.Engine4Fixed
--
local MainPart = script.Parent
local Smoke1 = MainPart.Smoke1.ParticleEmitter
local Smoke2 = MainPart.Smoke2.ParticleEmitter
local Prompt = MainPart.ProximityPrompt
local Values = workspace.Values
local EngineValue = Values.Engine
--
local WrenchSound = MainPart.WrenchWinding
local SoundPart = MainPart.SoundPart
local EngineLoop = SoundPart.EngineLoop
local EngineStart = SoundPart.EngineStart
local EngineStop = SoundPart.EngineStop
local SmokeSound = SoundPart.Smoke
local Tool = "Wrench"
--
Prompt.Triggered:Connect(function(player)
--
if player.Backpack:FindFirstChild(Tool) or player.Character:FindFirstChild(Tool) then
--
print("Player has Wrench")
local UsesValue = player.Backpack:FindFirstChild(Tool).Uses or player.Character:FindFirstChild(Tool).Uses -- Error Here
--
Prompt.Enabled = false
Smoke1.Enabled = false
Smoke2.Enabled = false
SmokeSound.Playing = false
EngineStart:Play()
--
wait(0.85)
Engine1FixedEvent:Fire()
EngineValue.Value = EngineValue.Value - 1
UsesValue.Value = UsesValue.Value + 1
EngineLoop:Play()
--
else
--
print("Player does not have Wrench")
--
end
--
end)
I’ve tried putting
local UsesValue = player.Backpack:FindFirstChild(Tool):WaitForChild("Uses") or player.Character:FindFirstChild(Tool):WaitForChild("Uses")
and
local UsesValue = player.Backpack:FindFirstChild(Tool):FindFirstChild("Uses") or player.Character:FindFirstChild(Tool):FindFirstChild("Uses")
Both didn’t work.
Any help is appreciated!
