Hello guys! I need some help with a staff only wall, I came across this topic:
The issue I’m having is it’s not working at all.
Original script:
local Proximity = script.Parent
local Proximity2 = game:GetService(“Workspace”).item.ProximityPrompt
local ProtectedCall = pcall
local GroupId = 0
local GroupRank = 0
Proximity.Triggered:Connect(function(Player)
local Success, Result = ProtectedCall(function()
return Player:GetRankInGroup(GroupId)
end)
if Success and
Result >= GroupRank then
local backpack = player.Backpack
local tool = game.ServerStorage.Cup -- make sure you have that item in serverstorage if not change to replicated storage and change “Cup” to your item mame.
local IsCup = true
local toolClone = tool:Clone()
if IsCup == true then
toolClone.Parent = backpack
end -- this might be an extra end if script doesnt work delete it and try again
end
end
end)
What I mortified:
local Proximity = script.Parent
local Proximity2 = game:GetService(“Workspace”).Part.ProximityPrompt1
local ProtectedCall = pcall
local GroupId = 17256639
local GroupRank = 1
Proximity.Triggered:Connect(function(Player)
local Success, Result = ProtectedCall(function()
return Player:GetRankInGroup(GroupId)
end)
if Success and
Result >= GroupRank then
local backpack = player.Backpack
local tool = game.ServerStorage.Part1 -- make sure you have that item in serverstorage if not change to replicated storage and change “Cup” to your item mame.
local IsCup = true
local toolClone = tool:Clone()
if IsCup == true then
toolClone.Parent = backpack
end -- this might be an extra end if script doesnt work delete it and try again
end
end
end)
local Proximity = script.Parent
local Proximity2 = workspace.Part.ProximityPrompt1
local GroupId = 17256639
local GroupRank = 1
Proximity.Triggered:Connect(function(Player)
local Rank
local Success, Errmsg = pcall(function()
Rank = Player:GetRankInGroup(GroupId)
end)
if Success and Rank >= GroupRank then
local backpack = player.Backpack
local tool = game.ServerStorage.Part1
local toolClone = tool:Clone()
toolClone.Parent = backpack
end
end)
You are trying to access ServerStorage from a LocalScript. Since anything on the server does not replicate to the clients, the Part1 instance in the ServerStorage won’t exist.
Then you should’ve described your issue better. I thought u needed help with your version of the script not working.
Try this:
local Proximity = script.Parent
local GroupId = 17256639
local GroupRank = 1
Proximity.Triggered:Connect(function(Player)
local Rank
local Success, Errmsg = pcall(function()
Rank = Player:GetRankInGroup(GroupId)
end)
if Success and Rank >= GroupRank then
local Position = Vector3.new() -- The position you want to teleport the player to
local Character = Player.Character
if not Character or not Character:FindFirstChild("Humanoid") then return end -- Checking if character exists
Character:MoveTo(Position) -- Moves the player's character to the desired position
end
end)
I need help with a staff only wall, I want to make it so a staff member can click the proximity prompt then it teleports them to the other side of the wall. I have the proximity prompt in workspace and the wall in serverstorage
You can place the wall in the workspace since we don’t need it for anything, then you can put the code in a script that’s parented under the ProximityPrompt in the workspace.
Then all you have to do is to enter the position the player is going to be teleported to, and it’s done.
Pretty easy, you can either replace the Vector3.new() with a part’s position that you want to teleport the player to (in that case you can do part.Position), or you can put a part behind your staff wall where you want the staff to be teleported, copy the position of that part, remove the part, and then paste the position value in the Vector3.new().
(for example, Vector3.new(0,0,0))
Also, I updated the code again. The Proximity2 variable was unnecessary.