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: HELP MY SCRIPT IS BEING CHEESY

Previous Thread :: Next Thread 
JustKakeGotStyle is not online. JustKakeGotStyle
Joined: 11 Nov 2014
Total Posts: 16
01 May 2016 01:59 AM
hi im trying to make a shop so that when a player touches a part it gives them a speed upgrade in my world of spleef game and here is my error


also this is not my script it is another robloxian who made it for me

OUTPUT:Script returned an error : Workspace.Part.Script:14: attempt to compare boolean with number


SCRIPT:

local SpeedBoost = script.Parent
local debounce = false

SpeedBoost.Touched:connect(function(Part)
if debounce then return end
debounce = true

local success, message = pcall(function()
if Part.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(Part.Parent)
if Player and Player:FindFirstChild("leaderstats") then
local leaderstats, Cash, Humanoid = Player:FindFirstChild("leaderstats"), Player.leaderstats:FindFirstChild("Cash"), Part.Parent:FindFirstChild("Humanoid")

if not (Cash.Value - 100) < 0 and not (Humanoid.WalkSpeed + 10) > 30 then
Cash.Value = Cash.Value -100
Humanoid.WalkSpeed = Humanoid.WalkSpeed + 10
end

end
end
end)

if not success then
print(script.Name.." returned an error : "..message)
end

wait(0.5)
debounce = false
end)
Report Abuse
Yamno is not online. Yamno
Joined: 10 Jun 2009
Total Posts: 123
01 May 2016 02:03 AM
"if not (Cash.Value - 100) < 0 and not (Humanoid.WalkSpeed + 10) > 30 then"

try

if not (Cash.Value - 100 < 0) and not (Humanoid.WalkSpeed + 10 > 30) then

Report Abuse
JustKakeGotStyle is not online. JustKakeGotStyle
Joined: 11 Nov 2014
Total Posts: 16
01 May 2016 02:09 AM
Thanks Problem Fixed No more cheese just MC Donalds Hates Me XD
Report Abuse
scottmike0 is not online. scottmike0
Joined: 14 Sep 2008
Total Posts: 1073
01 May 2016 02:12 AM
that should not have fixed the script, as both ways work.
Report Abuse
Yamno is not online. Yamno
Joined: 10 Jun 2009
Total Posts: 123
01 May 2016 02:34 AM
print( not (1 - 100) < 0 and not (1 + 10) > 30) -- error

print( not (1- 100 < 0) and not (1 + 10 > 30)) -- false

I thought so too, but I would never have noticed since I always wrap everything in parentheses. It turns out "not" has a higher priority than the other operations
Report Abuse
scottmike0 is not online. scottmike0
Joined: 14 Sep 2008
Total Posts: 1073
01 May 2016 04:35 AM
oh, there was a not, well that could be why.

I use ~=
or use "or"
Report Abuse
JustKakeGotStyle is not online. JustKakeGotStyle
Joined: 11 Nov 2014
Total Posts: 16
01 May 2016 12:09 PM
ok
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