Hello, as you can see on the video, there is a problem with the function that allows to take into account that the player is no longer on the platform. Indeed, the platform blinks while the player is on it while it should stay in Neon without changing color until the player actually leaves the platform. Does anyone know how I can fix this? the script is below the video. Thank you
--Server Script
script.Parent.A.Touched:Connect(function(hit)
end)
local player_list = {}
while task.wait() do
local tool_equipped = false
local part = "A"
for i,hit in pairs(script.Parent[part]:GetTouchingParts()) do
player_1 = game.Players:GetPlayerFromCharacter(hit.Parent)
if player_1 then
script.Parent[part].Material = Enum.Material.Neon --Part touched
tool_equipped = true
break
end
end
if not tool_equipped and script.Parent[part].Material == Enum.Material.Neon then
script.Parent[part].Material = Enum.Material.Plastic --Part untouched
end
I would use a table (or variable) that tells the script what players are already on the platform, and if the player is already on the platform, then you just let the script continue looping until the player gets off
Say, why does it have to be in a loop, is it to see if the player has a tool equipped? You can just accomplish it with just the touch event since player will still need to touch the brick. Anyways, the problem seem to be tool_equipped. Try printing hit.Parent, make sure it’s a character.