Remotes is not a valid member of RemoteEvent “ReplicatedStorage.CarDealerEvents.Remotes.buyCar”
local events = game.ReplicatedStorage.CarDealerEvents.Remotes:WaitForChild(“buyCar”)
Remotes is not a valid member of RemoteEvent “ReplicatedStorage.CarDealerEvents.Remotes.buyCar”
local events = game.ReplicatedStorage.CarDealerEvents.Remotes:WaitForChild(“buyCar”)
events should be
local events = game.ReplicatedStorage.CarDealerEvents
Oh yeah silly me, I do apologise.
The client isn’t changing anything?
change this line to
game.ReplicatedStorage.CarDealerEvents.Remotes.buyCar:FireServer(new.CarName.Text)
On the server of the player they are still not showing the cars inside of the frame
Yes, that’s why I had you do it on the client.
The button still shows on the cient
add a print to the client script.
--client script
local plr = game.Players.LocalPlayer
events.Remotes:WaitForChild("buyCar").OnClientEvent:Connect(function(vehicle, visible)
local scrf = plr.PlayerGui.CarSpawner.Selector.ScrollingFrame
local vehiclef = scrf:FindFirstChild(vehicle)
print(vehicle, visible)
if vehiclef then
print("vehicle found")
vehiclef.PurchaseButton.Visible = visible
end
end)
It doesn’t reach the to the print, could it be the server erroring before getting there?
I guess add a print to the server as well?
local prices = {
["BMW 530"] = 100
}
events.Remotes:WaitForChild("buyCar").OnServerEvent:Connect(function(plr, vehicle)
local plrMoney = plr.PlayerStats:WaitForChild("Bank")
local price = prices[vehicle]
if price and plrMoney.Value >= price then
plrMoney.Value -= price
print("Firing to client")
events.Remotes:WaitForChild("buyCar"):FireClient(plr, vehicle, false)
end
end)
--client script
local plr = game.Players.LocalPlayer
events.Remotes:WaitForChild("buyCar").OnClientEvent:Connect(function(vehicle, visible)
local scrf = plr.PlayerGui.CarSpawner.Selector.ScrollingFrame
local vehiclef = scrf:FindFirstChild(vehicle)
print(vehicle, visible)
if vehiclef then
print("vehicle found")
vehiclef.PurchaseButton.Visible = visible
end
end)
Players.ArchieStatixx.PlayerGui.CarSpawner.Selector.LocalScript:27: attempt to index nil with ‘CarSpawner’
local scrf = plr.PlayerGUI.CarSpawner.Selector.ScrollingFrame
I had fixed that after posting the reply, I guess you copied before I fixed that.
events.Remotes:WaitForChild(“buyCar”).OnClientEvent:Connect(function(plr, vehicle, visible)
local scrf = plr.PlayerGUI.CarSpawner.Selector.ScrollingFrame
local vehiclef = scrf:FindFirstChild(vehicle)
print(vehicle, visible)
if vehiclef then
print("vehicle found")
vehiclef.PurchaseButton.Visible = visible
end
end)
Again, I had already fixed it, just use this script
Yep, this is all now working, life saver, I appreciate it for staying and helping