Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FE MouseButton1Click won't work the way I need it to, why?

Asked by 5 years ago
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent

local eaf = plr.EmberAdminFolder

script.Parent.MouseButton1Click:Connect(function()

print("Detection test")

if eaf.CommandInv.Value == false then

eaf.CommandInv.Value = true

script.Parent.OnOff.ImageColor3 = Color3.fromRGB(44, 238, 255)

else

eaf.CommandInv.Value = false

script.Parent.OnOff.ImageColor3 = Color3.fromRGB(255,255,255)

end

end)

This works in a different thing using the same method.

pl = script.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()

local cur = pl.leaderstats.Embers

if cur.Value >=250 then

cur.Value = cur.Value - 5

local sword = game.ReplicatedStorage.Dependencies.Items.OpSword

sword:Clone().Parent = pl.Backpack

print(pl.Name.. " has purchased an OP sword!")

end

if cur.Value <=250 then

print(pl.Name.. " couldn't afford an OP sword. Rip.")

end

end)

They are both in server scripts, and I don't know why the first one won't work. Second one works fine, no errors, first one the click isn't detected.

None use remoteevents either, so I'm not sure why it errors

1
Due to FilteringEnabled, you should not be using MouseButton1Click with server scripts, change it to local scripts and learn to use RemoteEvents KawaiiX_Jimin 54 — 5y

Answer this question