Hey! Everyone, I’m Icy and today I’m going to be showing the basic element of a simulator
So without further todo lets get straight into it
- First We need data to store or points or data. go to serverscriptservice and create a script, name the script leaderstats
local function PlayerJoined(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local kills = Instance.new("IntValue", leaderstats)
kills.Name = "Points"
kills.Value = 0
local deaths = Instance.new("IntValue", leaderstats)
deaths.Name = "Money"
deaths.Value = 0
end
game.Players.PlayerAdded:Connect(PlayerJoined)
- Next We need our Points to go up
go to the toolbox on the top left hand corner and click it!
- next search “Weight” in the search bar
- You can use any model you would like
- MAKE SURE TO DELETE THE SCRIPTS INSIDE THE WEIGHT
- Next We need a RemoteEvent
- Click the plus sign in ReplicatedStorage and click “RemoteEvent”
- Next Name it “AddPoints”
-
create a LocalScript in the “Weight” that you selected
-
Type the following in your local script…
script.Parent.Activated:Connect(function()
game.ReplicatedStorage.AddPoints:FireServer()
script.Parent.Enabled = false
wait(1)
script.Parent.Enabled = true
end)
- Now that we Connected or AddPoints Event we need to Add Points to the leaderstats
type the following…
game.ReplicatedStorage.AddPoints.OnServerEvent:Connect(function(player)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
end)
Conclusion
You have complete part one of my simulator tutorial
I will post a link to part 2 in the future
but for now ill see you all later
bye