Hi,
I’m creating a marble game where your tag eachother in marbles. I am using a system to detect when a part with a name collides with the marble and then pass an “infection” onto the part. Unfortunately, the Studio returns “marblehit is not a valid member of Model”, even when it is in the model. Why is this happening? What can I do to fix it?
Thanks, Pevdn
“bgsdemo”
print("ballgamescript loaded")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local HRP = char:WaitForChild("HumanoidRootPart")
local marble = Instance.new("Part")
marble.Name = "marblehit"
marble.Size = Vector3.new(10,10,10)
marble.BrickColor = BrickColor.Random()
marble.Transparency = .5
marble.Shape = Enum.PartType.Ball
marble.Parent = char
marble.Material = Enum.Material.SmoothPlastic
local Velocity = Instance.new("BodyAngularVelocity")
Velocity.Parent = marble
local Hum = char:WaitForChild("Humanoid")
local Weld = Instance.new("Weld")
Weld.Parent = marble
Weld.Part0 = HRP
Weld.Part1 = marble
Hum.PlatformStand = true
while true do
wait()
marble.BodyAngularVelocity.AngularVelocity = Vector3.new(char.Humanoid.MoveDirection.z * 32,0,char.Humanoid.MoveDirection.x * -32)
marble.BodyAngularVelocity.MaxTorque = Vector3.new(10000,10000,10000)
if char.Humanoid.MoveDirection == Vector3.new(0,0,0) then
marble.BodyAngularVelocity.MaxTorque = Vector3.new(0,0,0)
end
end
end)
end)
“tagdemo”
print("tag loaded")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.marblehit.Touched:Connect(function(hit)
if hit:IsA("Part") and hit.Name == "marblehit" then
hit.BrickColor = BrickColor.new("Black")
end
end)
end)
end)
complete output:
Baseplate auto-recovery file was created - Studio
20:28:25.919 tag loaded - Server - tagdemo:1
20:28:25.919 ballgamescript loaded - Server - bgsdemo:1
20:28:27.645 Requiring asset 512742721.
Callstack:
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 29
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 28
- Server
20:28:27.693 initialized - Server
20:28:27.942 Requiring asset 518094091.
Callstack:
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 30
cloud_8428896693.archimedesTwo.initiatePlugin.MainModule, line 28
- Server
20:28:28.994 marblehit is not a valid member of Model "pevdn" - Server - tagdemo:5
20:28:28.994 Stack Begin - Studio
20:28:28.994 Script 'Workspace.ballgamescripts.tagdemo', Line 5 - Studio - tagdemo:5
20:28:28.994 Stack End - Studio
20:28:31.364 initialized - Client
proof that “marblehit” was created: