Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Trying to make a car gui. For some reason it doesn't set the valuable true?

starter character scripts server script:

local player = script.Parent
local humanoid = player:WaitForChild("Humanoid")
local playername = script.Parent.Name
local playergui = game.Players:WaitForChild(player.Name).PlayerGui
local sit = game.ReplicatedStorage.Sit
local NoSit = game.ReplicatedStorage.NoSit
while wait() do
	local function onSeated(isSeated, seat)
		if isSeated and seat.Name == "VehicleSeat" then
			sit:FireClient()
		elseif isSeated == false then
			NoSit:FireClient()
		end
	end
end

starter gui car local script:

local Depo = game:GetService("ReplicatedStorage")
local playergui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local sit = Depo.Sit
local NoSit = Depo.NoSit
local function onSitFired()
	playergui.car.Frame.Visible = true
end
sit.OnClientEvent:Connect(onSitFired)
local function onNoSitFired()
	playergui.car.Frame.Visible = false
end
NoSit.OnClientEvent:Connect(onNoSitFired)

1 answer

local function onSeated(isSeated, seat)
	        if isSeated and seat.Name == "VehicleSeat" then
	            sit:FireClient()
	        elseif isSeated == false then
          	  NoSit:FireClient()
	        end
	    end

correct me if i'm wrong but i dont think you called the function

instead try this

local player = script.Parent
local humanoid = player:WaitForChild("Humanoid")
local playername = script.Parent.Name
local playergui = game.Players:WaitForChild(player.Name).PlayerGui
local sit = game.ReplicatedStorage.Sit
local NoSit = game.ReplicatedStorage.NoSit

  local function onSeated(isSeated, seat)
        if isSeated and seat.Name == "VehicleSeat" then
            sit:FireClient()
        elseif isSeated == false then
            NoSit:FireClient()
        end
    end

while wait() do
  onSeated(argument1,argument2)
end

2 comments

0

what does line 17 do? im kinda new to the scripting

0

Not sure why but did not work

This discussion is preserved as it was. New answers, comments, and votes are closed.