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

How to change Value with remotevent? [closed]

Asked by 6 years ago

[localScript]


local player = game.Players.LocalPlayer local UserInputType = game:GetService("UserInputService") local Damage = script:WaitForChild("Damage") local ComboCount = script:WaitForChild("ComboCount") local IsCreated = script:WaitForChild("IsCreated") local IsClicked = script:WaitForChild("IsClicked") function FightControlls(input) if input.UserInputType == Enum.UserInputType.MouseButton1 and IsClicked.Value == false then ComboCount.Value = ComboCount.Value + 1 IsClicked.Value = true local HitDetector = player.Character:FindFirstChild("HitDetection") if not HitDetector then IsCreated.Value = true print("HitDetector not created") elseif HitDetector then IsCreated.Value = true print("hitdetector is created") end game.ReplicatedStorage.FightEvent:FireServer(Damage,ComboCount,IsClicked,IsCreated) end end UserInputType.InputBegan:Connect(FightControlls)

[ServerScript]


game.ReplicatedStorage.FightEvent.OnServerEvent:Connect(function(player,Damage, ComboCount,IsClicked,IsCreated) if IsCreated.Value == true then DetectionModel = game.ReplicatedStorage.HitDetection:Clone() DetectionModel.Parent = player.Character.Head local Weld = Instance.new("Weld") Weld.Part0 = DetectionModel.MainHolder Weld.Part1 = player.Character.Head Weld.Parent = player.Character.Head end DetectionModel.Detector.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") local Defense = hit.Parent:FindFirstChild("Defense") local punched = humanoid:LoadAnimation(script.Fighting.Punched0) print(IsClicked.Value) if humanoid and IsClicked.Value == true and not Defense then punched:Play() humanoid:TakeDamage(Damage.Value) punched:Stop() IsClicked.Value = false print(IsClicked.Value) end end) end)

**** OUTPUT

15:17:50.023 - ScriptRoom.rbxl was auto-saved HitDetector not created 15:18:07.082 - ServerScriptService.CombatSystemV3:4: attempt to index local 'IsCreated' (a nil value) 15:18:07.084 - Stack Begin 15:18:07.085 - Script 'ServerScriptService.CombatSystemV3', Line 4 15:18:07.086 - Stack End

0
Please healp masenyy1 -7 — 6y

Closed as Non-Descriptive by User#23365 and evaera

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?