Yeah, this is bugging me and I am stumped.

Just trying to find the IntValue of Health and the error pops up as,

"Config is not a valid member of Datamodel"

Model hierarchy is, https://gyazo.com/eeb5c723aae89620e92624f2c5b866e7

Here's my code below:

--ServerScript--
local Vehicle = hit.Parent.Parent.Config:FindFirstChild("Health")
		
	if Vehicle then
		Vehicle.Value = Vehicle.Value - 50
		end
	end

Any help would greatly be appreciated.

4 comments

0

what is hit supposed to be?

1

hit.Parent is Workspace, meaning hit.Parent.Parent is the DataModel, or game.

0

local hit, position = game.Workspace:FindPartOnRay(ray, user)

0

Ive also changed the hit.Parent around many times to try find the Config folder and ive gotten many different outputs.