Jump to content

money collector problem


zxo pink
 Share

Recommended Posts

hi i have this code:

if TotalMoney==nil then

TotalMoney=0

end

 

function Script:Start()

if TotalMoney==nil then

TotalMoney=0

end

Totalmoney=Totalmoney+1

end

 

function Script:Release()

Totalmoney=Totalmoney-1

end

 

function Script:UpdateWorld()

self.entity:Turn(0,1.0*Time:GetSpeed(),0,true)

end

 

function Script:Collision(entity, position, normal, speed)

if entity.script then

if type(entity.script.CollectMoney)=="function" then

entity.script:CollectMoney()

if self.sound then

self.sound:Play()

end

self.entity:Hide()

end

end

end

 

function Script:Detach()

if self.sound~=nil then

self.sound:Release()

self.sound=nil

end

end

 

and my error is:

 

attempt to perform arithmetic on global 'Totalmoney' (a nil value)

 

can somone please help me :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...