You can write your topic however you want, but you need to answer these questions:
I’ve been working on this project for a while, and this bug has been halting my progress. The bug is that a script, Local Script, and script, won’t work for other players. The mechanic is, that you click to kill, but when you press ‘E’, you cant be killed and become blind (becoming blind is fine). It’s hard for me to explain so here is a video.
-- RayCast Script
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local camera = workspace.CurrentCamera
local item = nil
local RS = game:GetService("ReplicatedStorage")
local function CreateRayCast()
local mousePosition = uis:GetMouseLocation()
local raycast = camera:ViewportPointToRay(mousePosition.x, mousePosition.y)
local rcResult = workspace:Raycast(raycast.Origin,raycast.Direction * 10000 )
return rcResult
end
uis.InputBegan:Connect(function(input, proc)
if input.UserInputType == Enum.UserInputType.MouseButton1 and not proc then
if item:IsA("BasePart") then
if item.name == "HumanoidRootPart" or item.name == "Torso" then
local RaycastPlayer = game.Players:GetPlayerFromCharacter(item.Parent)
game.ReplicatedStorage:WaitForChild("KillPlayer"):FireServer(RaycastPlayer)
print(RaycastPlayer.Name .. " Local")
end
end
end
end)
rs.RenderStepped:Connect(function()
local result = CreateRayCast()
if result and result.Instance then
item = result.Instance
end
end)
EToBlind Script:
-- E to blind script
local db = false
local dbTimer = 1
local WalkSpeedWhileBlind = 5
game.UserInputService.InputBegan:Connect(function(inp, proc)
if proc == true then return end
if db == true then return end
db = true
if inp.KeyCode == Enum.KeyCode.E then
print("press e")
-------------
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = WalkSpeedWhileBlind
-------------
game.ReplicatedStorage:WaitForChild("EToBlind"):FireServer()
end
task.wait(dbTimer)
db = false
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = 16
end)
Kill Script:
local RS = game:GetService("ReplicatedStorage")
game.ReplicatedStorage:WaitForChild("KillPlayer").OnServerEvent:Connect(function(player, RaycastPlayer)
local isBool
local children = RaycastPlayer:GetChildren()
for i = 1, #children do
local child = children[i]
if child:IsA("BoolValue") then
isBool = child
end
end
print(isBool.Value)
if player and isBool.Value == false then
RaycastPlayer.Character.Humanoid:TakeDamage(100)
print(isBool.Value)
print(RaycastPlayer.Name .. " Server")
else
print("no kill")
end
isBool = nil
end)
If you would like any more code or more pictures / videos, please feel free to ask!
local BlindFrame = game.StarterGui.Blind:WaitForChild("Frame")
game.ReplicatedStorage:WaitForChild("EToBlind").OnServerEvent:Connect(function(player)
local BlindFrame = player.PlayerGui.Blind.Frame
local BlindTip = player.PlayerGui.Blind.BlindTip
local BlindSound = player.PlayerGui.Blind["Light Switch ON"]
BlindSound:Play()
for i = 1,0, -0.2 do
wait(0.001)
BlindFrame.BackgroundTransparency = i
BlindTip.TextTransparency = i
end
BlindFrame.BackgroundTransparency = 0
BlindTip.TextTransparency = 0
task.wait(3)
BlindSound:Play()
for i = 0,1, 0.2 do
wait(0.001)
BlindFrame.BackgroundTransparency = i
BlindTip.TextTransparency = i
end
BlindFrame.BackgroundTransparency = 1
BlindTip.TextTransparency = 1
end)
Right thanks for the server output. Could you explain what the for loop on the kill script is checking for. I understand its a bool value, but what exactly is this bool value used for?
I copied the section of interest below.
for i = 1, #children do
local child = children[i]
if child:IsA("BoolValue") then
isBool = child
end
end
Ah sorry my bad a small formatting error, there should be no space. Basically playerBool_name is the name of the variable that holds the name of the bool for example in the code above you have have set the boolean name to bool.Name = p.Name .. "Blindness", therefore I also set a variable to get the player.name and add “Blindness” to it. so that it can be found and referenced inside the individual player.