You can use raycasting to check if the player is hopping on the part.
I have a working uncopylocked solution here if you want to try it out
I have all the parts that the player can jump on inside of a model.
What the code below is doing is shooting a ray below the character that ends slightly below the player.
If that ray is touching one of the parts in the whitelist (a table containing the parts in the model) then the player is touching that part so it changes the brickcolor.
local ModelContainingParts = script.Parent
function checkIfTouchingPart(player)
while true do
wait(.1)
if player.Character then
local start = player.Character.HumanoidRootPart.Position
local lookAt = player.Character.HumanoidRootPart.Position + Vector3.new(0,-5,0)
local lengthOfRayInStuds = 7
local whiteList = ModelContainingParts:GetChildren()
local ray = Ray.new(start, (lookAt-start).Unit * lengthOfRayInStuds)
local part, position = workspace:FindPartOnRayWithWhitelist(ray, whiteList)
if part then
part.BrickColor = BrickColor.Random()
print("part player is standing/jumping on: ", part)
end
end
end
end
game.Players.PlayerAdded:Connect(function(player)
spawn(function() checkIfTouchingPart(player) end)
end)
1 comment
This is interesting. I'll look into it in a bit.