PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Converting Experimental Mode Games: Code Sample 2

Converting Experimental Mode Games: Code Sample 2

Aug 06 2018, 8:38 PM PST

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = playerGui:WaitForChild("ScreenGui")
local spawnCarButton = screenGui:WaitForChild("SpawnCarButton")

local spawnCarEvent = ReplicatedStorage:WaitForChild("SpawnCarEvent")

local function onClick()
	spawnCarEvent:FireServer()	
end

spawnCarButton.MouseButton1Click:Connect(onClick)