I'm a beginner so help would be appreciated :) My script:
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if humanoid == nil then return end
frame.Enabled = true
wait(1)
frame.Enabled = false
end)
I'm a beginner so help would be appreciated :) My script:
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if humanoid == nil then return end
frame.Enabled = true
wait(1)
frame.Enabled = false
end)
Have you define humanoid and frame? If so then please show them if not then here is what you have to do:
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local humanoid = Seat.Occupant -- This is the humanoid of player sitting on the seat
local character = humanoid.Parent -- We need character to get player, character is humanoid's parent
local player = game:GetService("Players"):GetPlayerFromCharacter(character) -- Function that gets the player from character, we need it to access player gui
local player_gui = player:WaitForChild("PlayerGui") -- All the guis that player sees are inside of this instance, next we need to access the frame
local frame = player_gui:WaitForChild("FrameName") -- If you want to clone the frame then use :Clone() function
if humanoid == nil then return end
frame.Visible = true -- Sets the frame and all it's descendants not visible
wait(1)
frame.Visible= false -- Sets the frame and all it's descendants visible
end)
I hope you understood, i tried to explain from what i've seen in your script but i am not sure what you are trying to achieve and where is the error but this should work.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Thanks
Also put the if humanoid == nil before line 2 and you forgot to put end before end), sorry i forgot
Also put the if humanoid == nil before line 2 and you forgot to put end before end), sorry i forgot