it prints both "true" and "false" when i click the Warrior unit. how do i fix this?
THIS IS THE OUTPUT OF IT WHEN I CLICK THE UNIT
Selected Value: true Select Script(Normal Script)
Selected Value: false Control Script(Local Script)
> StarterPack
> > Units
> > > Warrior
> > > > ClickDetector
> > > > Owner
> > > > Select
> > > > Selected -- (Bool Value)
> > > > Control -- (Localscript)
it clones the warrior to the workspace when the player clicks a gui button
Select Script
local Warrior = script.Parent
local Selected = Warrior.Selected
function Clicked()
Selected.Value = true
print("Selected Value:", Selected.Value ,"Select Script(Normal Script)")
end
script.Parent.ClickDetector.MouseClick:connect(Clicked)
Control Script
local Warrior = script.Parent
local Selected = Warrior.Selected
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local hit = mouse.Hit.p
function onClick()
print("Selected Value:", Selected.Value ,"Control Script(Local Script)")
if Warrior.Selected.Value == true
then
Warrior.Position = mouse.Hit.p
end
end
mouse.Button1Down:connect(onClick)

2 comments
would there be any way to combine the selection script and the control? (since it needs mouse Target, i dont think so, but im just learning scripting.)
Just do it on both sides of the network why is this hard to understand?