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: Help! My shop wont work.

Previous Thread :: Next Thread 
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:13 PM
When the player touches a button, they are supposed to get a weapon for 0 kills. But it does not work. Here is script:

print("Shop Script Loaded")

Door = script.Parent
local debounce = false

function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouched(hit)
if debounce == false then
local human = hit.Parent:findFirstChild("Humanoid")
if (human == nil) then return end
local player = getPlayer(human)
debounce = true
if (player == nil) then return end
local stats = player:findFirstChild("leaderstats")
local sp = stats:findFirstChild("value") --This is the money name. If it costs KO's, then keep this the same. If not, put the exact currency name in (ex. Money, Currency, Cash, etc.)
if sp == nil then return false end
if (sp.Value >=0) then --Change 5 to the amnt of KOs it costs
sp.Value = sp.Value - 0 --Put the exact same number as you just put above.
print("Enough Money")
game.Debris. M2-84 Assault Rifle :clone().Parent = player.Backpack --Change WeaponName to your tool/weapon's name
game.Debris.M2-84 Assault Rifle:clone().Parent=player.StarterGear --Change WeaponName to your tool/weapon's name
Door.BrickColor = BrickColor.new(37) --Drag the tool/weapon into debris
wait(2)
Door.BrickColor = BrickColor.new(21) --Leave the rest of this alone
debounce = false
else debounce = false
end
end
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
14 Aug 2013 10:18 PM
local sp = stats:findFirstChild("value")


You really have KO's named 'value'?

Change it to the name of the intValue you have in the Leaderstats
Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:21 PM
ok I will try but I did try that value was the latest thing I tried.
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
14 Aug 2013 10:23 PM
Ok for me to fix it, what is the name of all your things in the leaderstats in the player.

(also tell me which you want it to look off of)
Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:23 PM
I tried everything this is leaderstats script maybe u could figure out what the in.value is.
Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:24 PM
print("LinkedLeaderboard script version 5.00 loaded")

stands = {}
CTF_mode = false


function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
local deaths = stats:findFirstChild("Wipeouts")
deaths.Value = deaths.Value + 1

-- do short dance to try and find the killer

local killer = getKillerOfHumanoidIfStillInGame(humanoid)

handleKillCount(humanoid, player)
end
end

function onPlayerRespawn(property, player)
-- need to connect to new humanoid

if property == "Character" and player.Character ~= nil then
local humanoid = player.Character.Humanoid
local p = player
local h = humanoid
humanoid.Died:connect(function() onHumanoidDied(h, p) end )
end
end

function getKillerOfHumanoidIfStillInGame(humanoid)
-- returns the player object that killed this humanoid
-- returns nil if the killer is no longer in the game

-- check for kill tag on humanoid - may be more than one - todo: deal with this
local tag = humanoid:findFirstChild("creator")

-- find player with name on tag
if tag ~= nil then

local killer = tag.Value
if killer.Parent ~= nil then -- killer still in game
return killer
end
end

return nil
end

function handleKillCount(humanoid, player)
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
if killer ~= nil then
local stats = killer:findFirstChild("leaderstats")
if stats ~= nil then
local kills = stats:findFirstChild("KOs")
if killer ~= player then
kills.Value = kills.Value + 1

else
kills.Value = kills.Value - 1

end
end
end
end
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
14 Aug 2013 10:24 PM
Not the script the actual model named leaderstats within the player. What are the children within it?
Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:33 PM
there is nothing under players the leaderboard is a script
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
14 Aug 2013 10:36 PM
local sp = stats:findFirstChild("KOs") --This is the money name. If it costs KO's, then keep this the same. If not, put the exact currency name in (ex. Money, Currency, Cash, etc.)
if sp == nil then return false end

(ง'̀-'́)ง If that wasn't it.............argg`1!


Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:41 PM
it is KOs so that part is right
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
14 Aug 2013 10:43 PM
Model:findFirstChild("NAMEOFOBJECTHERE"[,true/false check through the children for this])


You can't put value or else it will look for value.

You put KOs and it will search for KOs which it should find.
(ง'̀-'́)ง I got nothing
Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:48 PM
I switched money to KOs
Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 10:51 PM
I put KOs it does not work
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
14 Aug 2013 10:57 PM
print("Shop Script Loaded")

Door = script.Parent
local debounce = false

function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouched(hit)
if debounce == false then
local human = hit.Parent:findFirstChild("Humanoid")
if (human == nil) then return end
local player = getPlayer(human)
debounce = true
if (player == nil) then return end
local stats = player:findFirstChild("leaderstats")
local sp = stats:findFirstChild("KOs") -- THIS IS THE NAME OF THE OBJECT
--I AM GOING TO GO INSANE 0.1
if sp == nil then return false end
if (sp.Value >=0) then --Change 5 to the amnt of KOs it costs
sp.Value = sp.Value - 0 --Put the exact same number as you just put above.
print("Enough Money")
game.Debris. M2-84 Assault Rifle :clone().Parent = player.Backpack --Change WeaponName to your tool/weapon's name
game.Debris.M2-84 Assault Rifle:clone().Parent=player.StarterGear --Change WeaponName to your tool/weapon's name
Door.BrickColor = BrickColor.new(37) --Drag the tool/weapon into debris
wait(2)
Door.BrickColor = BrickColor.new(21) --Leave the rest of this alone
debounce = false
else debounce = false
end
end
Report Abuse
narwhale111 is not online. narwhale111
Joined: 04 Aug 2012
Total Posts: 527
14 Aug 2013 11:51 PM
It does not work. Do you know any shop scripts that will work because I use LinkedLeadeboard not Leaderstats.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
14 Aug 2013 11:53 PM
narwhale!
So we meet again?


I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
I HATE YOU!
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
14 Aug 2013 11:57 PM
Also
To help you..
The Value name has to be the same as one in the leaderbored.
And it doesent work in solo mode you have to play it yourself.
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