Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
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
0
what does line 17 do? im kinda new to the scripting efeozbilgin550 0 — 3y
0
Not sure why but did not work efeozbilgin550 0 — 3y
Ad

Answer this question