INTRODUCTION
I am not sure when, but up until recently my Hand to System had been working fine. I have watched countless videos but they are almost always no use or very vague. In advance, I would like to personally thank anyone who is attempting to help me out with this.
HOW THE “HAND TO SYSTEM” WORKS
While holding the tool that needs to be given, the employee enters the customer’s name in the GUI located on the left side labeled, “HAND TO PLAYER”. After entering their name the employee presses enter on their keyboard.
The customer is then prompted with a GUI for them to confirm whether or not this is their order. Pressing yes gives the customer the tool and awards the employee one point. Pressing “I didn’t order this” does nothing and closes the GUI. Pressing no revokes a point from the employee and the tool is not given out.
THE ISSUE
Everything for the most part works. The tool is given to the customer and the point is awarded.
However, on my end, it shows that my friend is not holding the tool. And after the tool is given my friend reports that the tool is broken. They are not able to activate the animation that comes with the tool nor are they able to add anything to the tool.
WHERE EVERYTHING IS AND THE SCRIPTS
Workspace:
This is the main part of the system where things like GUI for the customer and the script that displays the group rank and points is held.
Script for Datastore:
local groupID = 8532453
local minimumRank = 11
game.ReplicatedStorage.GiveSystem.GiveItem.OnServerEvent:Connect(function(plr, customer, order)
pcall(function()
if customer ~= nil and order ~= nil then
local gui = script.Parent.Receiver:Clone()
gui.Employee.Value = plr.Name
order.Parent = gui
gui.Frame.Question.Text = "WOULD YOU LIKE TO RECEIVE "..order.Name.." FROM "..plr.Name.."?"
gui.Parent = customer.PlayerGui
end
end)
end)
local array = {}
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local rank = Instance.new("StringValue", leaderstats)
rank.Name = "Rank"
rank.Value = player:GetRoleInGroup(groupID)
if player:GetRankInGroup(groupID) >= minimumRank then
local points = Instance.new("IntValue", leaderstats)
points.Name = "Points"
points.Value = game:GetService("DataStoreService"):GetDataStore("Points"):GetAsync("user_"..player.userId)
array[player.Name] = points.Value
else
local points = Instance.new("StringValue", leaderstats)
points.Name = "Points"
points.Value = "N/A"
end
end)
game.ReplicatedStorage.GiveSystem.AddPoint.OnServerEvent:Connect(function(cus,p)
plr = game.Players:FindFirstChild(p)
if plr ~= nil and plr.leaderstats.Points.Value ~= "N/A" then
plr.leaderstats.Points.Value = plr.leaderstats.Points.Value + 1
array[plr.Name] = plr.leaderstats.Points.Value
end
end)
game.ReplicatedStorage.GiveSystem.RevokePoint.OnServerEvent:Connect(function(cus,p)
plr = game.Players:FindFirstChild(p)
if plr ~= nil and plr.leaderstats.Points.Value ~= "N/A" then
plr.leaderstats.Points.Value = plr.leaderstats.Points.Value - 1
array[plr.Name] = plr.leaderstats.Points.Value
end
end)
game.Players.PlayerRemoving:Connect(function(player)
if array[player.Name] ~= nil then
game:GetService("DataStoreService"):GetDataStore("Points"):UpdateAsync("user_"..player.userId, function(oldValue)
local newValue = array[player.Name]
local val = newValue
return newValue
end)
wait()
array[player.Name] = nil
end
end)
Script for EventFire:
local frame = script.Parent
local gui = frame.Parent
frame:TweenPosition(UDim2.new(0.5, -200, 0.5, -75))
local employee = gui:WaitForChild("Employee")
local item = nil
for i,v in next, gui:GetChildren() do
if v.ClassName == "Tool" then
item = v
end
end
function onYes()
game.ReplicatedStorage.GiveSystem.AddPoint:FireServer(gui.Employee.Value)
item.Parent = game.Players.LocalPlayer.Backpack
frame:TweenPosition(UDim2.new(0.5, -200, 0, -121))
wait(1)
script.Parent:Destroy()
end
function onWrong()
frame:TweenPosition(UDim2.new(0.5, -200, 0, -121))
wait(1)
script.Parent:Destroy()
end
function onNo()
game.ReplicatedStorage.GiveSystem.RevokePoint:FireServer(gui.Employee.Value)
frame:TweenPosition(UDim2.new(0.5, -200, 0, -121))
wait(1)
script.Parent:Destroy()
end
frame.Yes.MouseButton1Click:Connect(onYes)
frame.No.MouseButton1Click:Connect(onNo)
frame.NotMine.MouseButton1Click:Connect(onWrong)
ReplicatedStorage:
StarterGui:
Note: The LocalScript at the top is for something else and is not apart of this system. Everything that is apart of the system in StarterGui is located under "HandToPlayerGUI.
Script for HandTo:
local groupID = 8532453
local minimumStaffRank = 11
local giveFrame = script.Parent:WaitForChild("GiveFrame")
local giveTextBox = giveFrame:WaitForChild("GiveTextBox")
if game.Players.LocalPlayer:GetRankInGroup(groupID) < minimumStaffRank then
script.Parent:Destroy()
return
else
giveFrame.Visible = true
end
giveTextBox.FocusLost:Connect(function(enterPressed)
if enterPressed then
local count = 0
local plr = nil
for i,v in next, game.Players:GetChildren() do
if string.len(v.Name) >= string.len(giveTextBox.Text) then
if string.lower(giveTextBox.Text) == string.lower(string.sub(v.Name,0,string.len(giveTextBox.Text))) then
count = count + 1
plr = v
end
end
end
giveTextBox.Text = "PLAYER NAME"
if count == 1 and game.Players.LocalPlayer.Name ~= plr.Name then
local item = nil
for i,v in next, game.Players.LocalPlayer.Character:GetChildren() do
if v.ClassName == "Tool" then
item = v
end
end
if item ~= nil then
game.ReplicatedStorage.GiveSystem.GiveItem:FireServer(plr,item)
end
giveTextBox.Text = "PLAYER NAME"
end
end
end)
CLOSING STATEMENT
Again I would like to thank anyone who has spent any time in trying to figure this out, I truly appreciate it.