when i sit on the seat the table (part) is suppose to be visible but its not doing that for some reason.
script:
local part = script.Parent
local part2 = game.Workspace.table1
part.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) if player then
part2.Transparency = 0
end
end)
Instead of using a touched event, why not use humanoid.seated.
local player = game.Players.localplayer
repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
function onSeated(isSeated) -- Code runs when function is fired
if isSeated then
print("I'm sitting")
else
print("I'm not sitting")
end
end
humanoid.Seated:Connect(onSeated) -- humanoid is sitting, fires function
Thats because “local player” in local player = game.Players.localplayer should be capitalized to local player = game.Players.LocalPlayer
I’d rather you figure this out yourself then having me spoon feed you.