how do i make it so the script detects if someone is sat on a certain seat?
Use this:
local Seat = script.Parent -- Path to seat
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant ~= nil then
-- your script
end
end)
the seat has a error on it-- -
Can you tell me what you want to do if the player sits on the chair, may be i can help
you have to make your own Seat Variable.
local YourSeat = -- Here
YourSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if YourSeat.Occupant ~= nil then
-- code
end
end)
when the player sits on the seat, if they’re below rank 2 then theyll jump and get a tshirt prompt
local YourSeat = script.Parent
local ShirtID = 1 -- Change To Your Shirt ID
local GroupID = 1 -- Change To Your Group ID
YourSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if YourSeat.Occupant ~= nil then
local hum = YourSeat.Occupant
local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
if plr then
if plr:GetRankInGroup(GroupID) < 2 then
hum.Jump = true
game:GetService("MarketplaceService"):PromptPurchase(plr,ShirtID)
end
end)
local Seats = workspace.Folder:GetChildren()
for _, v in pairs(Seats) do
v:GetPropertyChangedSignal("Occupant"):Connect(function()
if v.Occupant ~= nil then
print(v.Name)
end
end)
end
local Seat = script.Parent -- Path to seat
local ShirtID = 1 -- your shirt ID
local GroupID = 1 -- your group ID
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant ~= nil then
local hum = Seat.Occupant.Parent
local player = game.Players:GetPlayerFromCharacter(hum.Parent)
if player then
if player:GetRankInGroup(GroupID) < 2 then
hum.Jump = true
game:GetService("MarketPlaceService"):PromtPurchase(player, ShirtID)
end
end
end
end)
kk
what do you mean by the folder the value is in what value
The rank in game or the rank in the group?
did you even try my script yet?
rank in group
yeah it had errors and didnt work --------
you have to change YourSeat to your Seat. as well as the Shirt ID and the Group ID
Now I think It should work [I’m literally replying to so many messages so there can be errors]
you know what,
try this
put this inside your seat and change the IDS to your IDS.
local YourSeat = script.Parent
local ShirtID = 1 -- Change To Your Shirt ID
local GroupID = 1 -- Change To Your Group ID
YourSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if YourSeat.Occupant ~= nil then
local hum = YourSeat.Occupant.Parent
local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
if plr then
if plr:GetRankInGroup(GroupID) < 2 then
hum.Jump = true
game:GetService("MarketPlaceService"):PromptPurchase(plr,ShirtID)
end
end
end
end)
Should be working now!
local Seat = script.Parent -- Path to seat
local ShirtID = 1 -- your shirt ID
local GroupID = 1 -- your group ID
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant ~= nil then
local hum = Seat.Occupant.Parent
local player = game.Players:GetPlayerFromCharacter(hum.Parent)
if player then
if player:GetRankInGroup(GroupID) < 2 then
hum.Jump = true
game:GetService("MarketPlaceService"):PromtPurchase(player, ShirtID)
end
end
end
end)
Yes they do look similiar but I didn’t copy it [As you can see your code has some errors in it]
nope didnt work
local Seat = script.Parent.premseatscript – Path to seat
local ShirtID = 10453709879 – your shirt ID
Seat:GetPropertyChangedSignal(“Occupant”):Connect(function()
if Seat.Occupant ~= nil then
local hum = Seat.Occupant.Parent
local player = game.Players:GetPlayerFromCharacter(hum.Parent)
if player then
if player:GetRankInGroup(15554654) < 2 then
hum.Jump = true
game:GetService(“MarketPlaceService”):PromtPurchase(player, ShirtID)
end
end
end
end)