I am trying to make a script where you can break doors and walls for a game. But when I click on it there displays an error.
Error: "11:30:47.281 - Players.iiLevelMaker.PlayerGui.ScreenGui.Frame.HealthBG.Bar.LocalScript:10: attempt to index field 'Value' (a nil value)"
Serverscript (Inside Part):
script.Parent.ClickDetector.MouseClick:connect(function(player)
local obj = script.Parent
game:GetService("ReplicatedStorage").cutWood:FireClient(player, obj)
end)
LocalScript (Inside the "Bar" object seen in the error) 1st:
local player = game.Players.LocalPlayer
local obj = script.Parent.Obj
script.Parent.Health.Changed:connect(function(player)
local prog = script.Parent.Health
script.Parent:TweenSize(UDim2.new(prog.Value/100, 0, 1, 0), "In", "Linear", .1)
if prog.Value <= 0 then
prog.Value = 0
obj.Value.Anchored = false
end
end)
2nd Local script:
game:GetService("ReplicatedStorage").cutWood.OnClientEvent:connect(function(player, obj)
script.Parent.Obj.Value = obj
script.Parent.Health.Value = script.Parent.Health.Value - 10
end)
The health works fine, but the "Obj" value wont change, it's a objectvalue. It's supposed to change to the part the player is hitting.
