local enabled = true Player = script.Parent.Parent character = Player.CharacterAdded:wait(); mouse = Player:GetMouse() Run = game.GetService("RunService") RightShoulder = Player.Character.Torso["Right Shoulder"] function onKeyDown(key) key = key:lower() if key == "x" then RightShoulder = Player.Character.Torso["Right Shoulder"] Run = game:GetService("RunService") for i = 1,10 do RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16) wait(5) end game.GetService("Chat"):Chat(Player.Character.Head, "First comes ROCK!") end end mouse.KeyDown:connect(onKeyDown)
My error: 13:54:21.897 - Expected ':' not '.' calling member function GetService
You wrote game.GetService(
but you need to use game:GetService(
.
That is, .
and :
are similar but not the same. In most cases, only one is appropriate.
The technical description is that a:b(c)
is the same as a.b(a,c)
;
ROBLOX detects that you passed game.GetService
something that wasn't game
first and so it complains with this error.
That is, game.GetService(game, "Chat")
is a valid way to write this (however is poor style because it defeats the purpose of having :
)
On line 5 you have Run = game.GetService("RunService")
and it is saying it should be Run = game:GetService("RunService")
This error occurs also in line 16 it should be game:GetService("Chat"):Chat(Player.Character.Head, "First comes ROCK!")