|
| 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
|
  |
| 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 |
|
|
|
| 01 May 2016 02:09 AM |
| Thanks Problem Fixed No more cheese just MC Donalds Hates Me XD |
|
|
| Report Abuse |
|
|
|
| 01 May 2016 02:12 AM |
that should not have fixed the script, as both ways work.
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 01 May 2016 04:35 AM |
oh, there was a not, well that could be why.
I use ~= or use "or"
|
|
|
| Report Abuse |
|
|
| |
|