You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
a simple eat other players game for no reason
What is the issue? Include screenshots / videos if possible!
i cannot calculate the size.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
tried searching, that failed…
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
script.Parent:FindFirstChildOfClass("Humanoid").Touched:Connect(function(TP, HP)
if TP.Parent:FindFirstChildOfClass("Humanoid") and TP.Parent.HumanoidRootPart.Size.Magnitude <= script.Parent.HumanoidRootPart.Size.Magnitude then
script.Parent.HumanoidRootPart.Size += TP.Parent.HumanoidRootPart.Size
TP.Parent:Destroy()
end
end)
game["Run Service"].Heartbeat:Connect(function()
script.Parent:FindFirstChildOfClass('Humanoid').HipHeight = script.Parent:FindFirstChildOfClass("Humanoid").RootPart.Size.Y / 2
script.Parent.HumanoidRootPart.SelectionSphere.SurfaceColor3 = Color3.fromHSV(script.Parent.HumanoidRootPart.Size.Magnitude / 10, 1, 1)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
Basically, i need to calculate how far the ground should be from the ball itself.
Dividing it’s size by 2 will not work as I already tried that. It should not float off of the ground, and the ball is the player. No errors, and I cannot find anything to help me.
You might be able to accomplish this with raycasting, can you try the code below? I am not 100% sure it will work as I don’t have all the necessary components to experiment myself, but do let me know if it doesn’t solve your problem
local humanoid = script.Parent:FindFirstChildOfClass("Humanoid") :: Humanoid
local root = humanoid.RootPart
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.IgnoreWater
humanoid.Touched:Connect(function(TP, HP)
if TP.Parent:FindFirstChildOfClass("Humanoid") and TP.Parent.HumanoidRootPart.Size.Magnitude <= root.Size.Magnitude then
root.Size += TP.Parent.HumanoidRootPart.Size
TP.Parent:Destroy()
end
end)
game:GetService("RunService").Heartbeat:Connect(function()
raycastParams.FilterDescendantsInstances = {humanoid.Parent}
local result = workspace:Raycast(root.Position, Vector3.new(0, -100, 0), raycastParams)
if result then humanoid.HipHeight = root.Size.Y / 2 - result.Distance end
root.SelectionSphere.SurfaceColor3 = Color3.fromHSV(root.Size.Magnitude / 10, 1, 1)
end)
Change this line if result then humanoid.HipHeight = root.Size.Y / 2 - result.Distance end
To this: if result then humanoid.HipHeight = root.Size.Y - result.Distance end
Again it’s really hard to help you when I don’t have all the necessary info so please be patient with me