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 » Scripters
Home Search
 

Re: this script works for one player only

Previous Thread :: Next Thread 
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 07:11 AM
--Basically checks if the to#######f the button is a player, then adds money to that player.

--Uberubert
--This script is free to use for anyone

local ting = 0 --debouncer

function onTouched(hit)

if ting == 0 then --debounce check
ting = 1 --activate debounce
check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button

if check ~= nil then --If a human is found, then

local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder

if stats ~= nil then --If moneyholder exists then
local stage = stats:findFirstChild("Stage") --Get money
stage.Value = stage.Value +1 --increase amount of money by the number displayed here (500)
wait(3) --wait-time before button works again
end

end

ting = 1 --remove debounce
end

end

script.Parent.Touched:connect(onTouched)






i know that i used debounce but i need something that all players can use it..but just for one time.



#code if rap then print("this is my siggy, or idk")
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 07:12 AM
ignore the --[insert the texts here]

i just used a money giver script


#code if rap then print("this is my siggy, or idk")
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 07:15 AM
bumpp


#code if rap then print("this is my siggy, or idk")
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
17 Aug 2017 08:19 AM
guessing its a tycoon game?

whenever im making one I store the tycoon owners name (whoever touched the claim button) in a string value within the tycoon.

If you were to do the same you could say:

local owner = Instance.new("StringValue")
owner.Parent = script:FindFirstAncestor("Tycoon_Name")
owner.Name = "owner"
...
...

if (check ~= nil) and (hit.Parent.Name == owner.Value)
then...

Probably a better way to do it but im a noob so... :P
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 08:21 AM
no..it a thing mixed with a checkpoint that shows what stage are you at


#code if rap then print("this is my siggy, or idk")
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
17 Aug 2017 08:40 AM
---This bit goes in the script inside the claim button (unless its a gui) --
local owner = Instance.new("StringValue") -
owner.Parent = script:FindFirstAncestor("Tycoon_Name")
owner.Name = "owner"
--------------------------------------


local ting = 0 --debouncer
local find_owner = script:FindFirstAncestor("Tycoon_Name")
local owner = find_owner.Name

function onTouched(hit)

if ting == 0 then --debounce check
ting = 1 --activate debounce
check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button

if (check ~= nil) and (hit.Parent.Name == owner.Value) ---Inserted 2lines
then

local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder

if stats ~= nil then --If moneyholder exists then
local stage = stats:findFirstChild("Stage") --Get money
stage.Value = stage.Value +1 --increase amount of money by the number displayed here (500)
wait(3) --wait-time before button works again
end

end

ting = 1 --remove debounce
end

end

script.Parent.Touched:connect(onTouched)


maybe..
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 09:36 AM
ITS NOT A TYCOON


#code if rap then print("this is my siggy, or idk")
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
17 Aug 2017 10:37 AM
well thanks for correcting me after i literally posted "im guessing its a tycoon" and you let me continue to think it was a tycoon. Either way just store the name of the person you want to be able to use it somewhere and use it later in an if statement.

I've done this for free and you're caps locking me? next time figure stuff out for yourself you ungrateful ######
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 10:39 AM
look upper...i said it isnt a tycoon.

next time just look a bit upper


#code if rap then print("this is my siggy, or idk")
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
17 Aug 2017 10:48 AM
As seen in my previous post I've tried once again to help you and have still not received any thanks so; you're getting nothing from me and I'm going to rip on you for a while.. Enjoy

for a start upper isn't a word and "no..it a thing mixed with a checkpoint that shows what stage are you at" is THE most backwards sentence I've ever read.

"It a thing mixed" cool
"a checkpoint" so the entire game has a single checkpoint.. what?
"checkpoint that shows what stage.." the checkpoint wouldn't show you anything, a ui would show you information.
"shows what" isn't so bad but it should probably be "shows which"
"stage are you at" great

--Insert that link to "don't feed the arrogant noob" here
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 10:52 AM
yea sry for that thing im not american or something, i am romanian sry for that perfect sentence.




#code if rap then print("this is my siggy, or idk")
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
17 Aug 2017 11:06 AM
Just try to be a bit more clear in what you're trying to tell us, it's difficult to interpret what you're asking for if you don't explain it.



This script:
The script.Parent is a part?
Who do you want to be able to use the bottom?
or
How are you selecting which player can use the button?
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 11:08 AM
1. its a part

2. what do you mean? i want that everyone to use it but not to be able to spam it to get more points (stages)


#code if rap then print("this is my siggy, or idk")
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
17 Aug 2017 11:17 AM
oooooooooohhhhhhhhh

you want the script button to work once per player.

assuming the script is already correct:


local ting = 0 --debouncer

function onTouched(hit)

if ting == 0 then --debounce check
ting = 1 --activate debounce
check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button

if check ~= nil then --If a human is found, then

local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder

if (stats ~= nil) and (stage.Value < script.Parent.Name) then --If moneyholder exists then
local stage = stats:findFirstChild("Stage") --Get money
stage.Value = script.Parent.Name --increase amount of money by the number displayed here (500)
wait(3) --wait-time before button works again
end

end

ting = 1 --remove debounce
end

end

script.Parent.Touched:connect(onTouched)




name the script.Parent "1" or "2" etc. to represent the stage number (without the "")
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 11:48 AM
nope it does not work


#code if rap then print("this is my siggy, or idk")
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 11:49 AM
wait wait


#code if rap then print("this is my siggy, or idk")
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 11:53 AM
"Unknown global 'stage' "


#code if rap then print("this is my siggy, or idk")
Report Abuse
markjac is not online. markjac
Joined: 18 Jul 2009
Total Posts: 927
17 Aug 2017 11:55 AM
its a tycoon?
Report Abuse
JDLENL is online. JDLENL
Joined: 23 Dec 2009
Total Posts: 1109
17 Aug 2017 11:56 AM
lol
Report Abuse
Megablocker70 is not online. Megablocker70
Joined: 03 Dec 2016
Total Posts: 429
17 Aug 2017 12:01 PM
^^

no its an obby


#code if rap then print("this is my siggy, or idk")
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
17 Aug 2017 01:06 PM
local ting = 0 --debouncer

function onTouched(hit)

if ting == 0 then --debounce check
ting = 1 --activate debounce
check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button

if check ~= nil then --If a human is found, then

local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human
local stats = user:findFirstChild("leaderstats") --Find moneyholder

local stage = stats:findFirstChild("Stage") --Get money
if (stats ~= nil) and (stage.Value < script.Parent.Name) then --If moneyholder exists then
stage.Value = script.Parent.Name --increase amount of money by the number displayed here (500)
wait(3) --wait-time before button works again
end

end

ting = 1 --remove debounce
end

end

script.Parent.Touched:connect(onTouched)

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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