Hello. The problem is that you used GetService()
wrong. Instead of game("GetService, "RunService")
, you have to use game:GetService("RunService")
. Please try doing more research before asking. Try this:
02 | local player = game:GetService( "Players" ).LocalPlayer |
03 | local char = player.Character or player.CharacterAdded:wait() |
04 | local gui = player:WaitForChild( "PlayerGui" ) |
05 | local ui = gui:WaitForChild( "ui" ) |
08 | local rep = game.ReplicatedStorage |
09 | local assets = rep.Assets |
12 | local maps = assets.Maps |
15 | local signals = assets.Signals |
16 | local event = signals.Event |
17 | local fevent = signals.FEvent |
20 | local Game = workspace.Game |
21 | local stats = Game.Stats |
30 | event.OnClientEvent:Connect( function (variables) |
31 | if variables.reason = = "startVoting" then |
32 | table.insert(vars.services, game:GetService( "RunService" ).RenderStepped:Connect( function () |
33 | local ray = Ray.new(char.PrimaryPart.CFrame.p, Vector 3. new( 0 ,- 1000 , 0 )) |
34 | local object = workspace:FindPartOnRay(ray, char, false , false ) |
35 | if object and object.Name:match( "VotingPad" ) then |
36 | local votingPadNum = tonumber (object.Name:match( "%d+" )) |
37 | if vars.currentVote = = nil then |
38 | vars.currentVote = votingPadNum |
39 | event:FireServer( { reason = "voteOnMap" ; itemNum = votingPadNum; } ) |
40 | elseif vars.currentVote~ = votingPadNum then |
41 | vars.currentVote = votingPadNum |
42 | event:FireServer( { reason = "voteOnMap" ; itemNum = votingPadNum; } ) |
44 | elseif vars.currentVote~ = nil then |
46 | event:FireServer( { reason = "removeFromVote" } ) |
49 | elseif variables.reason = = "endVoting" then |
50 | for a,b in pairs (vars.services) do |
58 | game:GetService( "RunService" ).RenderStepped:Connect( function () |
59 | ui:WaitForChild( "Title" ).Text = stats.Status.Value |
Please accept and upvote this answer if it helps.