|
| 09 Apr 2017 03:48 PM |
local removeffs=player.Character:GetChildren() for i=1, #removeffs do if (removeffs[i].Name == ("SpecialForceField") or ("ForceField")) then removeffs[i]:Destroy() end
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 03:49 PM |
the character I mean.
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 09 Apr 2017 03:53 PM |
Because this:
if (removeffs[i].Name == ("SpecialForceField") or ("ForceField")) then
Is treated like this:
if (removeffs[i].Name == "SpecialForceField") or "ForceField" then |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 03:53 PM |
can you post the whole script since I can't test it due to missing stuff
r+://718058112r+://718058837 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 03:54 PM |
but as chimm said it should be:
(removeffs[i].Name == (("SpecialForceField") or ("ForceField")))
r+://718058112r+://718058837 |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 09 Apr 2017 03:55 PM |
I didn't say that.
Adding more parenthesis isn't going to fix it. |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 03:56 PM |
The extra parenthesise should treat it as:
removeeffs[i].Name == "SpecialForceField" or removeeffs[i].Name == ForceField
And I meant you mentioned that the line was wrong
r+://718058112r+://718058837 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 03:59 PM |
thanks guys, got it to work I just didn't know how to present that part of the script lol
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 09 Apr 2017 04:00 PM |
or is an operator on its own, it is not connected to the == operator in any way.
|
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:01 PM |
oh I see
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:04 PM |
(removeffs[i].Name == ("SpecialForceField") or ("ForceField"))
will always evaluate to true because the string "ForceField" is considered "truthy" or non-nil.
So it's like saying
if (removeffs[i].Name == "SpecialForceField" or true) then |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:06 PM |
If that's true why does: local allow = (player.Name == ("Player12" or "Player10")) if not allow then etc.
work for any name in the list
r+://718058112r+://718058837 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:11 PM |
| local allow = (player.Name == "Player12" or player.Name == "Player10") |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 09 Apr 2017 04:12 PM |
@iSent
The script first looks at "Player12" or "Player10" and determines that it's truthy because they're both not nil. After, it checks to see whether player.Name is truthy. Because the player name is always truthy as well, that line is basically setting the allow variable to true == true which is true. Therefore allow will always be true. |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:12 PM |
function onClicked() if script.Parent.Text =="OFF" then local removeffs=player.Character:GetChildren() for i=1, #removeffs do if removeffs[i].Name == "SpecialForceField" or removeffs[i].Name == "ForceField" then removeffs[i]:Destroy() local clone = game.ReplicatedStorage.RocketLauncher:Clone() clone.Parent=game.Players.LocalPlayer.Backpack script.Parent.Text="PVP"
end end having one more issue with the script, this gives the player 3 rocket launchers when they're only supposed to get one
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:14 PM |
nvm ignore me
I thought what I had worked but it didn't
r+://718058112r+://718058837 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:14 PM |
| That's because the part that gives the tool to the player is inside the for loop, so it may repeat a couple times depending on how many forcefields are found inside the character. |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:14 PM |
If the first value in my list is the name of the user then it works, but only looks at the first
r+://718058112r+://718058837 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:15 PM |
| oh I see, there are # ########### and @s it did work tho Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:15 PM |
@is it worked tho
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:16 PM |
nvm I just used the longer version but it works either way
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:17 PM |
the shorter version won't work
the longer version does
r+://718058112r+://718058837 |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 09 Apr 2017 04:23 PM |
...
for i,v in next, game.Players:GetPlayers() do local ff = v.Character:FindFirstChildOfClass('ForceField') if ff then ff:Destroy() end end
|
|
|
| Report Abuse |
|
|
|
| 09 Apr 2017 04:31 PM |
heh is that new cuz It would be a lot cleaner
Are you today's date.... Cause you're 10/ 10 TX69 |
|
|
| Report Abuse |
|
|