Script error help

Im trying to make a script that get triggered when a player triggers a proximity prompt. In the srcipt, i wrote that you need to be in a specific team in order for the script to work.

But the part where i wrote that nothing happens when your not in the right team has an error.

if you know a fix for this, i would like to know it.

Thank you

2 Likes

As the error points to, you used one = sign, you must use 2: ==

Also please don’t send screenshots of the code and instead copy-paste the code in between three ` (in the beginning and end of code)

ok ill send the code, and also even if i added ==, it doesnt work, its not printing the message in the output.

heres the code:

local Teams = game:GetService(“Teams”)
local CashierTeam = Teams.Cashier
local ProximityPrompt= game.Workspace.Customer1.Torso.ProximityPrompt

ProximityPrompt.Triggered:Connect(function(Player)
if Player.Team.Name == CashierTeam then
game.ReplicatedStorage.CustomerOrder1:FireClient(Player)
print(“Order Placed”)
ProximityPrompt.Enabled = false
elseif Player.Team.Name.Cashier == false then
print(“Order Failed, Player isn’t in the right team”)

end
end)

Ok thanks for sending the code but can you please format it next time, place it between ``` and another set of those.

Why are you looking for an object called Cashier on the TeamName??? What is the current error you are receiving

im not getting any errors, there isnt any, its just not working
i wrote that because if the playeer that triggers the proximity prompt isnt in the good team, the script doesnt do anything for them

Try this:

local Teams = game:GetService(“Teams”)
local CashierTeam = Teams.Cashier
local ProximityPrompt= game.Workspace.Customer1.Torso.ProximityPrompt

ProximityPrompt.Triggered:Connect(function(Player)
    if Player.Team.Name == CashierTeam then
        game.ReplicatedStorage.CustomerOrder1:FireClient(Player)
        print(“Order Placed”)
        ProximityPrompt.Enabled = false
    elseif Player.Team.Name ~= "Cashier" then
        print(“Order Failed, Player isn’t in the right team”)
    end
end)
1 Like

Thank you very much, its works

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.