generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Shop Script no work. x|

Previous Thread :: Next Thread 
gordon13 is not online. gordon13
Joined: 28 Jan 2010
Total Posts: 2206
24 Dec 2011 02:48 PM
I used:
function onPlayerEntered(newPlayer)

local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local cash = Instance.new("IntValue")
cash.Name = "KOs"
cash.Value = 1

cash.Parent = stats
stats.Parent = newPlayer
end



game.Players.ChildAdded:connect(onPlayerEntered)

to create the stats thing and put this in a brick:

function onTouched(hit)
if hit.Parent.Humanoid~= nil then
cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.Cash -- Find out who touched.
if cash.Value >= 1 then
cash.Value = cash.Value- 1
--What you want to happen goes here.
end
end
end
script.Parent.Touched:connect(onTouched)

when I touched the brick with one cash,it didn't take it away,why didn't it work?
Report Abuse
dennisvdz is not online. dennisvdz
Joined: 14 Dec 2008
Total Posts: 3710
24 Dec 2011 03:29 PM
cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.Cash

should be

cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.KOs



AND:

if hit.Parent.Humanoid~= nil then

should be

if hit.Parent:FindFirstChild("Humanoid") ~= nil then
Report Abuse
gordon13 is not online. gordon13
Joined: 28 Jan 2010
Total Posts: 2206
24 Dec 2011 04:04 PM
Still no work :(
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
24 Dec 2011 04:18 PM
Leaderboard Script:

function onAdded(player)
local l = Instance.new("IntValue")
local k = Instance.new("IntValue")

l.Name = "leaderstats"
k.Name = "KOs"

l.Parent = player
k.Parent = l

k.Value = 0
end

game.Players.PlayerAdded:connect(onAdded)

Shop Button Script:

partNames = {"Left Leg", "Right Leg", "Left Arm", "Right Arm", "Torso", "Head"}

function onTouched(hit)
for i = 1,#partNames do
if hit.Name == partNames[i] then
h = hit.Parent:findFirstChild("Humanoid")
if h ~= nil then
nme = hit.Parent.Name
p = game.Players:findFirstChild(nme)
p.leaderstats.KOs.Value = p.leaderstats.KOs.Values - 3
toolname = "Insert Tool Name Here"
tl = game.Lighting:findFirstChild(toolname)
tlc1 = tl:clone()
tlc2 = tl:clone()
tlc1.Parent = p.Backpack
tlc2.Parent = p.StarterGear
end
end
end
end

script.Parent.Touched:connect(onTouched)

P.S. My Fingers Hurt Now T.T


ˈ˟ˈ Scripter ˈ˟ˈ ~=~ 18čŵāŧfõƦĐ ~=~ ˈ˟ˈ Scripter ˈ˟ˈ site.Forum.["Help Center"].["Scripting Helpers"].Rank.Value = "Good Newbie"
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image