Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does this error mean?

Asked by 9 years ago
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

2 answers

Log in to vote
2
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

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 :)

Ad
Log in to vote
1
Answered by 9 years ago

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!")

Answer this question