-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgameBegin.lua
More file actions
44 lines (40 loc) · 1.73 KB
/
Copy pathgameBegin.lua
File metadata and controls
44 lines (40 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("gameBegin")
local serverTime = ReplicatedStorage:WaitForChild("timeSinceStart")
local RunService = game:GetService("RunService");
local physicsService = game:GetService("PhysicsService")
workspace.Gravity = 0
local begunTime = nil
remoteEvent.OnServerEvent:Connect(function()
if begunTime == nil then
begunTime = os.clock()
local pname = "player"
local ename = "enemies"
local bname = "bullets"
local iname = "ignore"
local gname = "goodBullet"
physicsService:RegisterCollisionGroup(iname)
physicsService:RegisterCollisionGroup(bname)
physicsService:RegisterCollisionGroup(ename)
physicsService:RegisterCollisionGroup(pname)
physicsService:RegisterCollisionGroup(gname)
physicsService:CollisionGroupSetCollidable(gname, pname, false)
physicsService:CollisionGroupSetCollidable(ename, gname, false)
physicsService:CollisionGroupSetCollidable(gname, bname, false)
physicsService:CollisionGroupSetCollidable(gname, iname, false)
physicsService:CollisionGroupSetCollidable(iname, bname, false)
physicsService:CollisionGroupSetCollidable(iname, pname, false)
physicsService:CollisionGroupSetCollidable(iname, iname, false)
physicsService:CollisionGroupSetCollidable(iname, ename, false)
physicsService:CollisionGroupSetCollidable(bname, bname, false)
physicsService:CollisionGroupSetCollidable(bname, pname, false)
physicsService:CollisionGroupSetCollidable(ename, pname, false)
physicsService:CollisionGroupSetCollidable(bname, ename, false)
end
end)
local function timeCalculator()
if begunTime ~= nil then
serverTime.Value = os.clock() - begunTime
end
end
RunService.Stepped:Connect(timeCalculator)